01: package example;
02:
03: import javax.persistence.*;
04:
05: import java.util.Collection;
06:
07: /**
08: * Implementation class for the House bean.
09: *
10: * <code><pre>
11: * CREATE TABLE amber_query_house (
12: * id BIGINT PRIMARY KEY auto_increment,
13: * name VARCHAR(250) UNIQUE NOT NULL
14: * );
15: * </pre></code>
16: */
17: @Entity
18: @Table(name="amber_query_house")
19: public class House {
20: private long _id;
21: private String _name;
22:
23: private Collection _studentList;
24:
25: public House() {
26: }
27:
28: public House(String name) {
29: _name = name;
30: }
31:
32: /**
33: * Returns the id of the house.
34: */
35: @Id
36: @Column(name="id")
37: @GeneratedValue
38: public long getId() {
39: return _id;
40: }
41:
42: /**
43: * Sets the id of the house.
44: */
45: public void setId(long id) {
46: _id = id;
47: }
48:
49: /**
50: * Returns the name of the house.
51: */
52: @Basic
53: @Column(unique=true)
54: public String getName() {
55: return _name;
56: }
57:
58: /**
59: * Sets the name of the house.
60: */
61: public void setName(String name) {
62: _name = name;
63: }
64:
65: /**
66: * returns a <code>Collection</code> of all Students living in this House.
67: */
68: @OneToMany(mappedBy="house")
69: public Collection<Student> getStudentList() {
70: return _studentList;
71: }
72:
73: /**
74: * returns a <code>Collection</code> of all Students living in this House.
75: */
76: public void setStudentList(Collection<Student> list) {
77: }
78: }
|