Created
February 15, 2015 16:07
-
-
Save vltsu/d0a489585958d419a962 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Employee { | |
@Id long empId; | |
String empName; | |
... | |
} | |
public class DependentId { | |
String name; // matches name of @Id attribute | |
long emp; // matches name of @Id attribute and type of Employee PK | |
} | |
@Entity | |
@IdClass(DependentId.class) | |
public class Dependent { | |
@Id String name; | |
// id attribute mapped by join column default | |
@Id @ManyToOne Employee emp; ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment