Hibernate JPA Callbacks

Hibernate JPA Callbacks


JPA also defines a more limited set of callbacks through annotations.

Callback annotations

Type

@PrePersist
Executed before the entity manager persist operation is actually executed or cascaded. This call is synchronous with the persist operation.

@PreRemove
Executed before the entity manager remove operation is actually executed or cascaded. This call is synchronous with the remove operation.

@PostPersist
Executed after the entity manager persist operation is actually executed or cascaded. This call is invoked after the database INSERT is executed.

@PostRemove
Executed after the entity manager remove operation is actually executed or cascaded. This call is synchronous with the remove operation.

@PreUpdate
Executed before the database UPDATE operation.

@PostUpdate
Executed after the database UPDATE operation.

@PostLoad
Executed after an entity has been loaded into the current persistence context or an entity has been refreshed.

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Hibernate Search - Elasticsearch with JSON manipulation

Spring Elasticsearch Operations