Composite Primary Keys In Hibernate | Code Factory
Download code and jars : Link. File : ProjectId.java package com.codeFactory.bean; import java.io.Serializable; public class ProjectId implements Serializable{ int departmentId; int projectId; public int getDepartmentId() { return departmentId; } public void setDepartmentId(int departmentId) { this.departmentId = departmentId; } public int getProjectId() { return projectId; } public void setProjectId(int projectId) { this.projectId = projectId; } } File : Project.java package com.codeFactory.bean; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.IdClass; @Entity @IdClass(ProjectId.class) public class Project { @Id int departmentId; @Id int projectId; public int getDepartmentId() { return departmentId; } public void setDepartmentId(int departmentId) { this.departmentId = departmentId; } public int getProjectId() { return...