Source code: org/hibernate/test/dynamicentity/tuplizer/EntityNameInterceptor.java
1 package org.hibernate.test.dynamicentity.tuplizer;
2
3 import org.hibernate.EmptyInterceptor;
4 import org.hibernate.test.dynamicentity.ProxyHelper;
5
6 /**
7 * @author <a href="mailto:steve@hibernate.org">Steve Ebersole </a>
8 */
9 public class EntityNameInterceptor extends EmptyInterceptor {
10 /**
11 * The callback from Hibernate to determine the entity name given
12 * a presumed entity instance.
13 *
14 * @param object The presumed entity instance.
15 * @return The entity name (pointing to the proper entity mapping).
16 */
17 public String getEntityName(Object object) {
18 String entityName = ProxyHelper.extractEntityName( object );
19 if ( entityName == null ) {
20 entityName = super.getEntityName( object );
21 }
22 return entityName;
23 }
24 }