org.hibernate.test.dynamicentity.interceptor
Class ProxyInterceptor
java.lang.Object
org.hibernate.EmptyInterceptor
org.hibernate.test.dynamicentity.interceptor.ProxyInterceptor
- All Implemented Interfaces:
- Serializable, Interceptor
public class ProxyInterceptor
- extends EmptyInterceptor
Our custom Interceptor
impl which performs the
interpretation of entity-name -> proxy instance and vice-versa.
- See Also:
- Serialized Form
Methods inherited from class org.hibernate.EmptyInterceptor |
afterTransactionBegin, afterTransactionCompletion, beforeTransactionCompletion, findDirty, getEntity, isTransient, onCollectionRecreate, onCollectionRemove, onCollectionUpdate, onDelete, onFlushDirty, onLoad, onPrepareStatement, onSave, postFlush, preFlush |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ProxyInterceptor
public ProxyInterceptor()
getEntityName
public String getEntityName(Object object)
- The callback from Hibernate to determine the entity name given
a presumed entity instance.
- Specified by:
getEntityName
in interface Interceptor
- Overrides:
getEntityName
in class EmptyInterceptor
- Parameters:
object
- The presumed entity instance.
- Returns:
- The entity name (pointing to the proper entity mapping).
instantiate
public Object instantiate(String entityName,
EntityMode entityMode,
Serializable id)
- The callback from Hibernate in order to build an instance of the
entity represented by the given entity name. Here, we build a
Proxy
representing the entity.
- Specified by:
instantiate
in interface Interceptor
- Overrides:
instantiate
in class EmptyInterceptor
- Parameters:
entityName
- The entity name for which to create an instance. In our setup,
this is the interface name.entityMode
- The entity mode in which to create an instance. Here, we are only
interestes in custom behavior for the POJO entity mode.id
- The identifier value for the given entity.
- Returns:
- The instantiated instance.
Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.