1 28 import javax.persistence.Entity; 29 import javax.persistence.Id; 30 import javax.persistence.JoinColumn; 31 import javax.persistence.ManyToOne; 32 import javax.persistence.Table; 33 34 35 36 40 @Entity 41 @Table(name="movie_cast") 42 public class Cast { 43 44 private int id; 45 private Movie movie; 46 private Person actor; 47 private String character; 48 private int importance; 49 50 public Cast() { 51 } 52 53 public Cast(int id, Movie movie, Person actor, String character, int importance) { 54 this.id = id; 55 this.movie = movie; 56 this.actor = actor; 57 this.character = character; 58 this.importance = importance; 59 } 60 61 @Id 62 public int getId() { 63 return id; 64 } 65 66 public void setId(int id) { 67 this.id = id; 68 } 69 70 @JoinColumn(name="movie") 71 @ManyToOne 72 public Movie getMovie() { 73 return movie; 74 } 75 76 public void setMovie(Movie movie) { 77 this.movie = movie; 78 } 79 80 @JoinColumn(name="actor") 81 @ManyToOne 82 public Person getActor() { 83 return actor; 84 } 85 86 public void setActor(Person actor) { 87 this.actor = actor; 88 } 89 90 public String getCharacter() { 91 return character; 92 } 93 94 public void setCharacter(String character) { 95 this.character = character; 96 } 97 98 public int getImportance() { 99 return importance; 100 } 101 102 public void setImportance(int importance) { 103 this.importance = importance; 104 } 105 } 106 | Popular Tags |