package examples.entity.uni.one_to_many; import java.io.Serializable; import java.util.Collection; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.OneToMany; @Entity(name="CompanyOMUni") public class Company implements Serializable { private int id; private String name; private Collection employees; public Company() { id = (int)System.nanoTime(); } @Id public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } @OneToMany(cascade={CascadeType.ALL},fetch=FetchType.EAGER) public Collection getEmployees() { return employees; } public void setEmployees(Collection employees) { this.employees = employees; } }