1 28 import java.sql.Date ; 29 30 import javax.persistence.Entity; 31 import javax.persistence.Id; 32 import javax.persistence.JoinColumn; 33 import javax.persistence.ManyToOne; 34 import javax.persistence.OneToMany; 35 36 37 41 @Entity 42 public class Movie { 43 44 private int id; 45 private Person director; 46 private String title; 47 private String genre; 48 private Date releaseDate; 49 50 private java.util.Collection <Cast> cast; 51 private java.util.Collection <Varia> varia; 52 53 public Movie() { 54 } 55 56 public Movie(int id, Person director, String title, String genre, Date releaseDate) { 57 this.id = id; 58 this.director = director; 59 this.title = title; 60 this.genre = genre; 61 this.releaseDate = releaseDate; 62 } 63 64 @Id 65 public int getId() { 66 return id; 67 } 68 69 public void setId(int id) { 70 this.id = id; 71 } 72 73 @JoinColumn(name="director") 74 @ManyToOne 75 public Person getDirector() { 76 return director; 77 } 78 79 public void setDirector(Person director) { 80 this.director = director; 81 } 82 83 public String getTitle() { 84 return title; 85 } 86 87 public void setTitle(String title) { 88 this.title = title; 89 } 90 91 public String getGenre() { 92 return genre; 93 } 94 95 public void setGenre(String genre) { 96 this.genre = genre; 97 } 98 99 public Date getReleaseDate() { 100 return releaseDate; 101 } 102 103 public void setReleaseDate(Date releaseDate) { 104 this.releaseDate = releaseDate; 105 } 106 107 @OneToMany(mappedBy="movie") 108 public java.util.Collection <Cast> getCast() { 109 return this.cast; 110 } 111 112 public void setCast(java.util.Collection <Cast> cast) { 113 this.cast = cast; 114 } 115 116 @OneToMany(mappedBy="movie") 117 public java.util.Collection <Varia> getVaria() { 118 return this.varia; 119 } 120 121 public void setVaria(java.util.Collection <Varia> varia) { 122 this.varia = varia; 123 } 124 } 125
| Popular Tags
|