Last active
December 15, 2015 14:39
-
-
Save nemo83/5276313 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
public class Project { | |
@Id | |
private long id; | |
... | |
@OneToMany | |
private List<ProjectAssociation> employees; | |
... | |
// Add an employee to the project. | |
// Create an association object for the relationship and set its' data.publicvoid addEmployee(Employee employee, boolean teamLead) { | |
ProjectAssociation association =new ProjectAssociation(); | |
association.setEmployee(employee); | |
association.setProject(this); | |
association.setEmployeeId(employee.getId()); | |
association.setProjectId(this.getId()); | |
association.setIsTeamLead(teamLead); | |
employees.add(association); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment