modernize Interceptor + Lifecycle interfaces

This commit is contained in:
Gavin King 2021-03-04 13:51:05 +01:00
parent b3aa7d0794
commit 7b7597f40e
17 changed files with 317 additions and 161 deletions

View File

@ -7,128 +7,20 @@
package org.hibernate;
import java.io.Serializable;
import java.util.Iterator;
import org.hibernate.type.Type;
/**
* An interceptor that does nothing. May be used as a base class for application-defined custom interceptors.
*
* @author Gavin King
*
* @deprecated implement {@link Interceptor} directly
*/
@Deprecated
public class EmptyInterceptor implements Interceptor, Serializable {
/**
* The singleton reference.
*/
public static final Interceptor INSTANCE = new EmptyInterceptor();
protected EmptyInterceptor() {
}
@Override
public void onDelete(
Object entity,
Serializable id,
Object[] state,
String[] propertyNames,
Type[] types) {}
@Override
public boolean onFlushDirty(
Object entity,
Serializable id,
Object[] currentState,
Object[] previousState,
String[] propertyNames,
Type[] types) {
return false;
}
@Override
public boolean onLoad(
Object entity,
Serializable id,
Object[] state,
String[] propertyNames,
Type[] types) {
return false;
}
@Override
public boolean onSave(
Object entity,
Serializable id,
Object[] state,
String[] propertyNames,
Type[] types) {
return false;
}
@Override
public void postFlush(Iterator entities) {
}
@Override
public void preFlush(Iterator entities) {
}
@Override
public Boolean isTransient(Object entity) {
return null;
}
@Override
public Object instantiate(String entityName, EntityMode entityMode, Serializable id) {
return null;
}
@Override
public int[] findDirty(
Object entity,
Serializable id,
Object[] currentState,
Object[] previousState,
String[] propertyNames,
Type[] types) {
return null;
}
@Override
public String getEntityName(Object object) {
return null;
}
@Override
public Object getEntity(String entityName, Serializable id) {
return null;
}
@Override
public void afterTransactionBegin(Transaction tx) {
}
@Override
public void afterTransactionCompletion(Transaction tx) {
}
@Override
public void beforeTransactionCompletion(Transaction tx) {
}
@Override
public String onPrepareStatement(String sql) {
return sql;
}
@Override
public void onCollectionRemove(Object collection, Serializable key) throws CallbackException {
}
@Override
public void onCollectionRecreate(Object collection, Serializable key) throws CallbackException {
}
@Override
public void onCollectionUpdate(Object collection, Serializable key) throws CallbackException {
}
protected EmptyInterceptor() {}
}

View File

@ -32,7 +32,6 @@ import org.hibernate.type.Type;
* @see SessionBuilder#interceptor(Interceptor)
* @see SharedSessionBuilder#interceptor()
* @see org.hibernate.cfg.Configuration#setInterceptor(Interceptor)
* @see EmptyInterceptor
*
* @author Gavin King
*/
@ -53,8 +52,73 @@ public interface Interceptor {
* @return {@code true} if the user modified the <tt>state</tt> in any way.
*
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*
* @deprecated use {@link #onLoad(Object, Object, Object[], String[], Type[])}
*/
boolean onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException;
@Deprecated
default boolean onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types)
throws CallbackException {
return false;
}
/**
* Called just before an object is initialized. The interceptor may change the <tt>state</tt>, which will
* be propagated to the persistent object. Note that when this method is called, <tt>entity</tt> will be
* an empty uninitialized instance of the class.
* <p/>
* NOTE: The indexes across the <tt>state</tt>, <tt>propertyNames</tt> and <tt>types</tt> arrays match.
*
* @param entity The entity instance being loaded
* @param id The identifier value being loaded
* @param state The entity state (which will be pushed into the entity instance)
* @param propertyNames The names of the entity properties, corresponding to the <tt>state</tt>.
* @param types The types of the entity properties, corresponding to the <tt>state</tt>.
*
* @return {@code true} if the user modified the <tt>state</tt> in any way.
*
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*/
default boolean onLoad(Object entity, Object id, Object[] state, String[] propertyNames, Type[] types)
throws CallbackException {
if (id instanceof Serializable) {
return onLoad(entity, (Serializable) id, state, propertyNames, types);
}
return false;
}
/**
* Called when an object is detected to be dirty, during a flush. The interceptor may modify the detected
* <tt>currentState</tt>, which will be propagated to both the database and the persistent object.
* Note that not all flushes end in actual synchronization with the database, in which case the
* new <tt>currentState</tt> will be propagated to the object, but not necessarily (immediately) to
* the database. It is strongly recommended that the interceptor <b>not</b> modify the <tt>previousState</tt>.
* <p/>
* NOTE: The indexes across the <tt>currentState</tt>, <tt>previousState</tt>, <tt>propertyNames</tt> and
* <tt>types</tt> arrays match.
*
* @param entity The entity instance detected as being dirty and being flushed
* @param id The identifier of the entity
* @param currentState The entity's current state
* @param previousState The entity's previous (load time) state.
* @param propertyNames The names of the entity properties
* @param types The types of the entity properties
*
* @return {@code true} if the user modified the <tt>currentState</tt> in any way.
*
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*
* @deprecated use {@link #onFlushDirty(Object, Object, Object[], Object[], String[], Type[])}
*/
@Deprecated
default boolean onFlushDirty(
Object entity,
Serializable id,
Object[] currentState,
Object[] previousState,
String[] propertyNames,
Type[] types) throws CallbackException {
return false;
}
/**
* Called when an object is detected to be dirty, during a flush. The interceptor may modify the detected
@ -77,13 +141,40 @@ public interface Interceptor {
*
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*/
boolean onFlushDirty(
default boolean onFlushDirty(
Object entity,
Serializable id,
Object id,
Object[] currentState,
Object[] previousState,
String[] propertyNames,
Type[] types) throws CallbackException;
Type[] types) throws CallbackException {
if (id instanceof Serializable) {
return onFlushDirty(entity, (Serializable) id, currentState, previousState, propertyNames, types);
}
return false;
}
/**
* Called before an object is saved. The interceptor may modify the <tt>state</tt>, which will be used for
* the SQL <tt>INSERT</tt> and propagated to the persistent object.
*
* @param entity The entity instance whose state is being inserted
* @param id The identifier of the entity
* @param state The state of the entity which will be inserted
* @param propertyNames The names of the entity properties.
* @param types The types of the entity properties
*
* @return <tt>true</tt> if the user modified the <tt>state</tt> in any way.
*
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*
* @deprecated use {@link #onSave(Object, Object, Object[], String[], Type[])}
*/
@Deprecated
default boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types)
throws CallbackException {
return false;
}
/**
* Called before an object is saved. The interceptor may modify the <tt>state</tt>, which will be used for
@ -99,7 +190,30 @@ public interface Interceptor {
*
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*/
boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException;
default boolean onSave(Object entity, Object id, Object[] state, String[] propertyNames, Type[] types)
throws CallbackException {
if (id instanceof Serializable) {
return onSave(entity, (Serializable) id, state, propertyNames, types);
}
return false;
}
/**
* Called before an object is deleted. It is not recommended that the interceptor modify the <tt>state</tt>.
*
* @param entity The entity instance being deleted
* @param id The identifier of the entity
* @param state The state of the entity
* @param propertyNames The names of the entity properties.
* @param types The types of the entity properties
*
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*
* @deprecated use {@link #onDelete(Object, Object, Object[], String[], Type[])}
*/
@Deprecated
default void onDelete(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types)
throws CallbackException {}
/**
* Called before an object is deleted. It is not recommended that the interceptor modify the <tt>state</tt>.
@ -112,7 +226,25 @@ public interface Interceptor {
*
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*/
void onDelete(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException;
default void onDelete(Object entity, Object id, Object[] state, String[] propertyNames, Type[] types)
throws CallbackException {
if (id instanceof Serializable) {
onDelete(entity, (Serializable) id, state, propertyNames, types);
}
}
/**
* Called before a collection is (re)created.
*
* @param collection The collection instance.
* @param key The collection key value.
*
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*
* @deprecated use {@link #onCollectionRecreate(Object, Object)}
*/
@Deprecated
default void onCollectionRecreate(Object collection, Serializable key) throws CallbackException {}
/**
* Called before a collection is (re)created.
@ -122,7 +254,24 @@ public interface Interceptor {
*
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*/
void onCollectionRecreate(Object collection, Serializable key) throws CallbackException;
default void onCollectionRecreate(Object collection, Object key) throws CallbackException {
if (key instanceof Serializable) {
onCollectionRecreate(collection, (Serializable) key);
}
}
/**
* Called before a collection is deleted.
*
* @param collection The collection instance.
* @param key The collection key value.
*
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*
* @deprecated use {@link #onCollectionRemove(Object, Object)}
*/
@Deprecated
default void onCollectionRemove(Object collection, Serializable key) throws CallbackException {}
/**
* Called before a collection is deleted.
@ -132,7 +281,24 @@ public interface Interceptor {
*
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*/
void onCollectionRemove(Object collection, Serializable key) throws CallbackException;
default void onCollectionRemove(Object collection, Object key) throws CallbackException {
if (key instanceof Serializable) {
onCollectionRemove(collection, (Serializable) key);
}
}
/**
* Called before a collection is updated.
*
* @param collection The collection instance.
* @param key The collection key value.
*
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*
* @deprecated use {@link #onCollectionUpdate(Object, Object)}
*/
@Deprecated
default void onCollectionUpdate(Object collection, Serializable key) throws CallbackException {}
/**
* Called before a collection is updated.
@ -142,8 +308,11 @@ public interface Interceptor {
*
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*/
void onCollectionUpdate(Object collection, Serializable key) throws CallbackException;
default void onCollectionUpdate(Object collection, Object key) throws CallbackException {
if (key instanceof Serializable) {
onCollectionUpdate(collection, (Serializable) key);
}
}
/**
* Called before a flush.
*
@ -151,7 +320,7 @@ public interface Interceptor {
*
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*/
void preFlush(Iterator entities) throws CallbackException;
default void preFlush(Iterator<Object> entities) throws CallbackException {}
/**
* Called after a flush that actually ends in execution of the SQL statements required to synchronize
@ -161,7 +330,7 @@ public interface Interceptor {
*
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*/
void postFlush(Iterator entities) throws CallbackException;
default void postFlush(Iterator<Object> entities) throws CallbackException {}
/**
* Called to distinguish between transient and detached entities. The return value determines the
@ -175,7 +344,41 @@ public interface Interceptor {
* @param entity a transient or detached entity
* @return Boolean or <tt>null</tt> to choose default behaviour
*/
Boolean isTransient(Object entity);
default Boolean isTransient(Object entity) {
return null;
}
/**
* Called from <tt>flush()</tt>. The return value determines whether the entity is updated
* <ul>
* <li>an array of property indices - the entity is dirty
* <li>an empty array - the entity is not dirty
* <li><tt>null</tt> - use Hibernate's default dirty-checking algorithm
* </ul>
*
* @param entity The entity for which to find dirty properties.
* @param id The identifier of the entity
* @param currentState The current entity state as taken from the entity instance
* @param previousState The state of the entity when it was last synchronized (generally when it was loaded)
* @param propertyNames The names of the entity properties.
* @param types The types of the entity properties
*
* @return array of dirty property indices or {@code null} to indicate Hibernate should perform default behaviour
*
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*
* @deprecated use {@link #findDirty(Object, Object, Object[], Object[], String[], Type[])}
*/
@Deprecated
default int[] findDirty(
Object entity,
Serializable id,
Object[] currentState,
Object[] previousState,
String[] propertyNames,
Type[] types) {
return null;
}
/**
* Called from <tt>flush()</tt>. The return value determines whether the entity is updated
@ -196,13 +399,18 @@ public interface Interceptor {
*
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*/
int[] findDirty(
default int[] findDirty(
Object entity,
Serializable id,
Object id,
Object[] currentState,
Object[] previousState,
String[] propertyNames,
Type[] types);
Type[] types) {
if (id instanceof Serializable) {
return findDirty(entity, (Serializable) id, currentState, previousState, propertyNames, types);
}
return null;
}
/**
* Instantiate the entity class. Return <tt>null</tt> to indicate that Hibernate should use
@ -220,7 +428,9 @@ public interface Interceptor {
* @deprecated Use {@link #instantiate(String, EntityRepresentationStrategy, Object)} instead
*/
@Deprecated
Object instantiate(String entityName, EntityMode entityMode, Serializable id) throws CallbackException;
default Object instantiate(String entityName, EntityMode entityMode, Serializable id) throws CallbackException {
return null;
}
/**
* Instantiate the entity. Return <tt>null</tt> to indicate that Hibernate should use
@ -231,8 +441,11 @@ public interface Interceptor {
String entityName,
EntityRepresentationStrategy representationStrategy,
Object id) throws CallbackException {
if (id instanceof Serializable) {
return instantiate( entityName, representationStrategy.getMode().getLegacyEntityMode(), (Serializable) id );
}
return null;
}
/**
* Get the entity name for a persistent or transient instance.
@ -243,7 +456,26 @@ public interface Interceptor {
*
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*/
String getEntityName(Object object) throws CallbackException;
default String getEntityName(Object object) throws CallbackException {
return null;
}
/**
* Get a fully loaded entity instance that is cached externally.
*
* @param entityName the name of the entity
* @param id the instance identifier
*
* @return a fully initialized entity
*
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*
* @deprecated use {@link #getEntity(String, Object)}
*/
@Deprecated
default Object getEntity(String entityName, Serializable id) throws CallbackException {
return null;
}
/**
* Get a fully loaded entity instance that is cached externally.
@ -255,7 +487,12 @@ public interface Interceptor {
*
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*/
Object getEntity(String entityName, Serializable id) throws CallbackException;
default Object getEntity(String entityName, Object id) throws CallbackException {
if (id instanceof Serializable) {
return getEntity(entityName, (Serializable) id);
}
return null;
}
/**
* Called when a Hibernate transaction is begun via the Hibernate <tt>Transaction</tt>
@ -264,21 +501,21 @@ public interface Interceptor {
*
* @param tx The Hibernate transaction facade object
*/
void afterTransactionBegin(Transaction tx);
default void afterTransactionBegin(Transaction tx) {}
/**
* Called before a transaction is committed (but not before rollback).
*
* @param tx The Hibernate transaction facade object
*/
void beforeTransactionCompletion(Transaction tx);
default void beforeTransactionCompletion(Transaction tx) {}
/**
* Called after a transaction is committed or rolled back.
*
* @param tx The Hibernate transaction facade object
*/
void afterTransactionCompletion(Transaction tx);
default void afterTransactionCompletion(Transaction tx) {}
/**
* Called when sql string is being prepared.
@ -289,5 +526,7 @@ public interface Interceptor {
* to inspect and alter SQL statements.
*/
@Deprecated
String onPrepareStatement(String sql);
default String onPrepareStatement(String sql) {
return sql;
}
}

View File

@ -5,11 +5,12 @@
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.classic;
import java.io.Serializable;
import org.hibernate.CallbackException;
import org.hibernate.Session;
import java.io.Serializable;
/**
* Provides callbacks from the <tt>Session</tt> to the persistent object.
* Persistent classes <b>may</b> implement this interface but they are not
@ -46,12 +47,12 @@ public interface Lifecycle {
/**
* Return value to veto the action (true)
*/
public static final boolean VETO = true;
boolean VETO = true;
/**
* Return value to accept the action (false)
*/
public static final boolean NO_VETO = false;
boolean NO_VETO = false;
/**
* Called when an entity is saved.
@ -59,7 +60,9 @@ public interface Lifecycle {
* @return true to veto save
* @throws CallbackException Indicates a problem happened during callback
*/
public boolean onSave(Session s) throws CallbackException;
default boolean onSave(Session s) throws CallbackException {
return NO_VETO;
}
/**
* Called when an entity is passed to <tt>Session.update()</tt>.
@ -69,7 +72,9 @@ public interface Lifecycle {
* @return true to veto update
* @throws CallbackException Indicates a problem happened during callback
*/
public boolean onUpdate(Session s) throws CallbackException;
default boolean onUpdate(Session s) throws CallbackException {
return NO_VETO;
}
/**
* Called when an entity is deleted.
@ -77,7 +82,9 @@ public interface Lifecycle {
* @return true to veto delete
* @throws CallbackException Indicates a problem happened during callback
*/
public boolean onDelete(Session s) throws CallbackException;
default boolean onDelete(Session s) throws CallbackException {
return NO_VETO;
}
/**
* Called after an entity is loaded. <em>It is illegal to
@ -88,5 +95,23 @@ public interface Lifecycle {
* @param s the session
* @param id the identifier
*/
public void onLoad(Session s, Serializable id);
default void onLoad(Session s, Object id) {
if (id instanceof Serializable) {
onLoad(s, (Serializable) id);
}
}
/**
* Called after an entity is loaded. <em>It is illegal to
* access the <tt>Session</tt> from inside this method.</em>
* However, the object may keep a reference to the session
* for later use.
*
* @param s the session
* @param id the identifier
*
* @deprecated use {@link #onLoad(Session, Object)}
*/
@Deprecated
default void onLoad(Session s, Serializable id) {}
}

View File

@ -262,7 +262,7 @@ public abstract class AbstractFlushingEventListener implements JpaBootstrapSensi
persistenceContext.forEachCollectionEntry(
(coll, ce) -> {
if ( ce.isDorecreate() ) {
interceptor.onCollectionRecreate( coll, (Serializable) ce.getCurrentKey() );
interceptor.onCollectionRecreate( coll, ce.getCurrentKey() );
actionQueue.addAction(
new CollectionRecreateAction(
coll,
@ -273,7 +273,7 @@ public abstract class AbstractFlushingEventListener implements JpaBootstrapSensi
);
}
if ( ce.isDoremove() ) {
interceptor.onCollectionRemove( coll, (Serializable) ce.getLoadedKey() );
interceptor.onCollectionRemove( coll, ce.getLoadedKey() );
actionQueue.addAction(
new CollectionRemoveAction(
coll,
@ -285,7 +285,7 @@ public abstract class AbstractFlushingEventListener implements JpaBootstrapSensi
);
}
if ( ce.isDoupdate() ) {
interceptor.onCollectionUpdate( coll, (Serializable) ce.getLoadedKey() );
interceptor.onCollectionUpdate( coll, ce.getLoadedKey() );
actionQueue.addAction(
new CollectionUpdateAction(
coll,

View File

@ -400,7 +400,7 @@ public abstract class AbstractSaveEventListener
SessionImplementor source) {
boolean substitute = source.getInterceptor().onSave(
entity,
(Serializable) id,
id,
values,
persister.getPropertyNames(),
persister.getPropertyTypes()

View File

@ -267,7 +267,7 @@ public class DefaultDeleteEventListener implements DeleteEventListener, Callback
session.getInterceptor().onDelete(
entity,
(Serializable) entityEntry.getId(),
entityEntry.getId(),
deletedState,
persister.getPropertyNames(),
propTypes

View File

@ -340,7 +340,7 @@ public class DefaultFlushEntityEventListener implements FlushEntityEventListener
final boolean answerFromInterceptor = session.getInterceptor().onFlushDirty(
entity,
(Serializable) entry.getId(),
entry.getId(),
values,
entry.getLoadedState(),
persister.getPropertyNames(),
@ -486,7 +486,7 @@ public class DefaultFlushEntityEventListener implements FlushEntityEventListener
int[] dirtyProperties = session.getInterceptor().findDirty(
entity,
(Serializable) id,
id,
values,
loadedState,
persister.getPropertyNames(),

View File

@ -76,7 +76,7 @@ public class DefaultPostLoadEventListener implements PostLoadEventListener, Call
protected void invokeLoadLifecycle(PostLoadEvent event, EventSource session) {
if ( event.getPersister().implementsLifecycle() ) {
//log.debug( "calling onLoad()" );
( (Lifecycle) event.getEntity() ).onLoad( session, (Serializable) event.getId() );
( (Lifecycle) event.getEntity() ).onLoad( session, event.getId() );
}
}
}

View File

@ -24,7 +24,7 @@ public class DefaultPreLoadEventListener implements PreLoadEventListener {
final EntityPersister persister = event.getPersister();
event.getSession().getInterceptor().onLoad(
event.getEntity(),
(Serializable) event.getId(),
event.getId(),
event.getState(),
persister.getPropertyNames(),
persister.getPropertyTypes()

View File

@ -538,7 +538,7 @@ public class SessionImpl
// logically, is PersistentContext the "thing" to which an interceptor gets attached?
final Object result = persistenceContext.getEntity( key );
if ( result == null ) {
final Object newObject = getInterceptor().getEntity( key.getEntityName(), (Serializable) key.getIdentifier() );
final Object newObject = getInterceptor().getEntity( key.getEntityName(), key.getIdentifier() );
if ( newObject != null ) {
lock( newObject, LockMode.NONE );
}

View File

@ -475,7 +475,7 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen
return result;
}
final Object newObject = getInterceptor().getEntity( key.getEntityName(), (Serializable) key.getIdentifier() );
final Object newObject = getInterceptor().getEntity( key.getEntityName(), key.getIdentifier() );
if ( newObject != null ) {
persistenceContext.addEntity( key, newObject );
return newObject;

View File

@ -128,7 +128,7 @@ public class Foo implements Lifecycle, FooProxy, Serializable {
return NO_VETO;
}
public void onLoad(Session db, Serializable id) {
public void onLoad(Session db, Object id) {
}
public String getKey() {

View File

@ -96,7 +96,7 @@ public class Fum implements Lifecycle, Serializable {
}
public void onLoad(Session s, Serializable id) {
public void onLoad(Session s, Object id) {
}

View File

@ -105,7 +105,7 @@ public class Glarch extends Super implements GlarchProxy, Lifecycle, Named, Seri
return NO_VETO;
}
public void onLoad(Session s, Serializable id) {
public void onLoad(Session s, Object id) {
if ( ! ( ( (String) id ).length()==32 ) ) throw new RuntimeException("id problem");
}

View File

@ -65,7 +65,7 @@ public class Qux implements Lifecycle {
return NO_VETO;
}
public void onLoad(Session session, Serializable id) {
public void onLoad(Session session, Object id) {
loaded=true;
this.session=session;
}

View File

@ -64,7 +64,7 @@ public class Vetoer implements Lifecycle {
return result;
}
public void onLoad(Session s, Serializable id) {}
public void onLoad(Session s, Object id) {}
}

View File

@ -107,7 +107,7 @@ public abstract class BaseEnversEventListener implements EnversListener {
toEntityName = session.guessEntityName( value );
final IdMapper idMapper = enversService.getEntitiesConfigurations().get( toEntityName ).getIdMapper();
id = (Serializable) idMapper.mapToIdFromEntity( value );
id = idMapper.mapToIdFromEntity( value );
}
final Set<String> toPropertyNames = enversService.getEntitiesConfigurations().getToPropertyNames(