Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package entities;
- import javax.persistence.*;
- import java.util.Set;
- @Entity
- @Table(name = "addresses")
- public class Address {
- private Integer id;
- private String text;
- private Town town;
- private Set<Employee> employees;
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "address_id")
- public Integer getId() {
- return id;
- }
- public void setId(Integer id) {
- this.id = id;
- }
- @Column(name = "address_text")
- public String getText() {
- return text;
- }
- public void setText(String text) {
- this.text = text;
- }
- @ManyToOne
- @JoinColumn(name = "town_id",referencedColumnName = "town_id")
- public Town getTown() {
- return town;
- }
- public void setTown(Town town) {
- this.town = town;
- }
- @OneToMany(mappedBy = "address")
- public Set<Employee> getEmployees() {
- return employees;
- }
- public void setEmployees(Set<Employee> employees) {
- this.employees = employees;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement