Wednesday 3 July 2019

JPA: Primary keys


Every entity must have a primary key. Primary key can be simple or composite.

Simple Primary Key
Simple primary key corresponds to a single persistent fields or property of the class. @Id annotation is used to define a simple primary key.

Composite primary key
It is a combination of more than one persistent field. The EmbeddedId or IdClass annotation is used to denote a composite primary key.




Previous                                                    Next                                                    Home

No comments:

Post a Comment