Tutorialspoint examples

Learn java tutorial with examples for beginners online

JPA EmbeddableId annotation


The EmbeddableId annotation is used to create a composite primary key. It can also be applied to a persistent field or property of an entity class or mapped superclass to denote a composite primary key that is an embeddable class.

Example:

@Embeddable public class Zipcode {
       protected String zip;
       protected String plusFour;
}
 
@Embeddable public class Address {
       protected String street;
       protected String city;
       protected String state;
       @EmbeddedId protected Zipcode zipcode;
}

Posted in JPA   
Download tutorialspointexamples Android App
Copyright © 2018 Tutorialspoint examples DMCA.com Protection Status