Jernej Jerin
Jernej Jerin

Reputation: 3399

What is column mapping kind in JPA Hibernate

What is column mapping kind in JPA (Hibernate implementation) entity and what are the differences between these three options available:

Upvotes: 0

Views: 140

Answers (1)

JB Nizet
JB Nizet

Reputation: 692071

@Basic is used to map a field to a column.

@Id is used to tell Hibernate that the field is (or is a part of) the identifier of the entity (i.e. the primary key)

@Version is used to tell Hibernate that the annotated field constitutes the field to use as the version for optimistic locking. This field will be checked before every update, and incremented at each update. It's described in the documentation under the optimistic locking section.

All these annotations are also well described in their javadoc.

Upvotes: 1

Related Questions