JPA EntityInterceptor implementation should allow additional entities to be created

Description

Current implementation using JPA EntityListener is too limited because it does not allow additional entities (eg auditing records) to be created within the same transaction.

Activity

Arne Vandamme July 8, 2015 at 10:58 AM

Note that entity intercepting support requires the JPA repositories to be created using the custom EntityInterceptingJpaRepositoryFactoryBean. The use of @EnableAcrossJpaRepositories instead of the default @EnableJpaRepositories will enable this by default. See .

Arne Vandamme June 25, 2015 at 7:06 PM

Behavior of EntityInterceptor has been refactored. It now hooks to JpaRepository methods and executes outside the repository specific transaction. Creating additional entities should no longer be a problem as the JPA entity lifecycle events are no longer used.

An outer transaction will apply to the interceptor methods as well, but it is not easy to force a new transaction within an interceptor that will wrap both interceptor method and the inner repository method. An issue has been created for this, see separate issue link.

Fixed

Details

Assignee

Reporter

Original estimate

Time tracking

No time logged2d remaining

Components

Fix versions

Priority

Created March 6, 2015 at 6:50 AM
Updated September 10, 2015 at 6:56 AM
Resolved June 26, 2015 at 2:36 PM