package com.testdb.model; import java.util.Date; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; import javax.persistence.ManyToMany; import javax.persistence.ManyToOne; import javax.persistence.NamedQuery; import javax.persistence.Table; @Entity @Table(name = "film") @NamedQuery(name = "Film.getFilmByLanguage",query = "select f from Film f where f.lang = ?1") public class Film { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "film_id") private Long id; private String description; private String title; @Column(name = "release_year") private int releaseYear; @Column(name = "rental_duration") private long rentalDuration; @Column(name = "rental_rate") private float rentalRate; @Column(name = "length") private long length; @Column(name = "replacement_cost") private float replacementCost; @ManyToOne(cascade = CascadeType.MERGE) @JoinColumn(name = "language_id",referencedColumnName = "language_id") private Language lang; @ManyToMany() @JoinTable(name = "film_actor", joinColumns = @JoinColumn(name="film_id"), inverseJoinColumns = @JoinColumn(name="actor_id")) private List actors; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public int getReleaseYear() { return releaseYear; } public void setReleaseYear(int releaseYear) { this.releaseYear = releaseYear; } public long getRentalDuration() { return rentalDuration; } public void setRentalDuration(long rentalDuration) { this.rentalDuration = rentalDuration; } public float getRentalRate() { return rentalRate; } public void setRentalRate(float rentalRate) { this.rentalRate = rentalRate; } public long getLength() { return length; } public void setLength(long length) { this.length = length; } public float getReplacementCost() { return replacementCost; } public void setReplacementCost(float replacementCost) { this.replacementCost = replacementCost; } public Language getLang() { return lang; } public void setLang(Language lang) { this.lang = lang; } public void setActors(List actors) { this.actors = actors; } public List getActors() { return actors; } }