public java.lang.Object | instantiate(java.lang.String entityName, org.hibernate.EntityMode entityMode, java.io.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
{@link Proxy} representing the entity.
if ( entityMode == EntityMode.POJO ) {
if ( Customer.class.getName().equals( entityName ) ) {
return ProxyHelper.newCustomerProxy( id );
}
else if ( Company.class.getName().equals( entityName ) ) {
return ProxyHelper.newCompanyProxy( id );
}
}
return super.instantiate( entityName, entityMode, id );
|