Composite Primary Keys Using Embeddable In Hibernate | Code Factory
Download code and jars : Link. File : UserId.java package com.codeFactory.bean; import java.io.Serializable; import javax.persistence.Embeddable; @Embeddable public class UserId implements Serializable { String firstName; String lastName; public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } } File : User.java package com.codeFactory.bean; import javax.persistence.AttributeOverride; import javax.persistence.Column; import javax.persistence.EmbeddedId; import javax.persistence.Entity; @Entity public class User { @EmbeddedId @AttributeOverride(name = "firstName", column = @Column(name = "fid_firstnam...