Film.java 2.99 KB
Newer Older
Joel Florentin committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
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<Actor> 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<Actor> actors) {
        this.actors = actors;
    }
    public List<Actor> getActors() {
        return actors;
    }

    
}