-
-
Save rvillablanca/8fe506d5a16dbec24f580ac6df877a14 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 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