1 |
package dk.thoerup.hibertest1;
|
2 |
|
3 |
import java.io.Serializable;
|
4 |
|
5 |
import javax.persistence.Column;
|
6 |
import javax.persistence.Entity;
|
7 |
import javax.persistence.GeneratedValue;
|
8 |
import javax.persistence.GenerationType;
|
9 |
import javax.persistence.Id;
|
10 |
import javax.persistence.JoinColumn;
|
11 |
import javax.persistence.ManyToOne;
|
12 |
import javax.persistence.Table;
|
13 |
|
14 |
|
15 |
|
16 |
@Entity
|
17 |
@Table(name = "employee")
|
18 |
|
19 |
|
20 |
|
21 |
public class Employee implements Serializable {
|
22 |
private static final long serialVersionUID = 1L;
|
23 |
|
24 |
public Employee() {
|
25 |
}
|
26 |
|
27 |
@Id
|
28 |
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
29 |
@Column(name = "id")
|
30 |
Integer id;
|
31 |
|
32 |
@Column(name = "name")
|
33 |
String name;
|
34 |
|
35 |
|
36 |
@ManyToOne( )
|
37 |
@JoinColumn( name="dept", nullable=false)
|
38 |
Department department;
|
39 |
|
40 |
|
41 |
public Integer getId() {
|
42 |
return id;
|
43 |
}
|
44 |
|
45 |
public void setId(Integer id) {
|
46 |
this.id = id;
|
47 |
}
|
48 |
|
49 |
public String getName() {
|
50 |
return name;
|
51 |
}
|
52 |
|
53 |
public void setName(String name) {
|
54 |
this.name = name;
|
55 |
}
|
56 |
|
57 |
public Department getDepartment() {
|
58 |
return department;
|
59 |
}
|
60 |
|
61 |
public void setDepartment(Department department) {
|
62 |
this.department = department;
|
63 |
}
|
64 |
|
65 |
|
66 |
|
67 |
} |