com.taggercat.util
Class HibernateUtils

java.lang.Object
  extended by com.taggercat.util.HibernateUtils

public class HibernateUtils
extends java.lang.Object

The class name says it all

 

Constructor Summary
HibernateUtils()
           
 
Method Summary
static void applyMtTenantFilter(org.hibernate.Session session)
           
static IResultSetCollection getChildCollectionAsResultSet(com.taggercat.el.ELContext elContext, DataSource childDS)
          Returns the collection of child entities for the CURRENT_ENTITY_EXPRESSION_CONTEXT_OBJ from the named child data source as a result set
static java.lang.Object getEntityByStringID(java.lang.String entityClass, java.lang.String idStringValue)
          Gets an entity by the string representation of the ID
static java.util.Map<java.lang.String,org.hibernate.metadata.ClassMetadata> getMultiTenantClasses(org.hibernate.SessionFactory sessionFactory, org.hibernate.cfg.Configuration hbn8Config)
          Returns a map of all multi-tenant enabled persistent classes.
static java.util.Collection<?> initializeCollection(java.lang.Object parentEntity, java.util.Collection<?> collection)
           
static boolean needsReassociation(org.hibernate.Session session, java.lang.Object obj)
          Tests to see if a entity needs to be re-associated with a session to read a property
static boolean needsReassociation(org.hibernate.Session session, java.lang.Object obj, java.lang.String entityName)
          Tests to see if an entity needs to be re-associated with a session to read an non-initialized property or collection.
static void setMetaDataCatalog(java.lang.String catalogName, org.hibernate.cfg.Configuration hbn8Config)
          The the DB catalog (schema) where the application's metadata resides.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HibernateUtils

public HibernateUtils()
Method Detail

needsReassociation

public static boolean needsReassociation(org.hibernate.Session session,
                                         java.lang.Object obj)
Tests to see if a entity needs to be re-associated with a session to read a property

Parameters:
session -
obj -
Returns:
true if the object needs to be re-associated

needsReassociation

public static boolean needsReassociation(org.hibernate.Session session,
                                         java.lang.Object obj,
                                         java.lang.String entityName)
Tests to see if an entity needs to be re-associated with a session to read an non-initialized property or collection.

Parameters:
session -
obj -
Returns:
true if the object needs to be re-associated

initializeCollection

public static java.util.Collection<?> initializeCollection(java.lang.Object parentEntity,
                                                           java.util.Collection<?> collection)

getEntityByStringID

public static java.lang.Object getEntityByStringID(java.lang.String entityClass,
                                                   java.lang.String idStringValue)
Gets an entity by the string representation of the ID

Parameters:
entityClass - the entity's classname
idStringValue - the string representation of the ID
Returns:
the object if it exists

getChildCollectionAsResultSet

public static IResultSetCollection getChildCollectionAsResultSet(com.taggercat.el.ELContext elContext,
                                                                 DataSource childDS)
Returns the collection of child entities for the CURRENT_ENTITY_EXPRESSION_CONTEXT_OBJ from the named child data source as a result set

Parameters:
elContext -
childDS -
Returns:
the collection of child entities for the CURRENT_ENTITY_EXPRESSION_CONTEXT_OBJ from the named child data source as a result set. If there is no matching CURRENT_ENTITY_EXPRESSION_CONTEXT_OBJ then returns null

getMultiTenantClasses

public static java.util.Map<java.lang.String,org.hibernate.metadata.ClassMetadata> getMultiTenantClasses(org.hibernate.SessionFactory sessionFactory,
                                                                                                         org.hibernate.cfg.Configuration hbn8Config)
Returns a map of all multi-tenant enabled persistent classes. Multi-tenant classes are identified by the existence of the "mtTenantName" property. contains a property

Parameters:
sessionFactory - the session factory
hbn8Config - the hibernate configuration object

setMetaDataCatalog

public static void setMetaDataCatalog(java.lang.String catalogName,
                                      org.hibernate.cfg.Configuration hbn8Config)
The the DB catalog (schema) where the application's metadata resides. Of course the default is the same schema as that of the application's data

Parameters:
catalogName -
hbn8Config -

applyMtTenantFilter

public static void applyMtTenantFilter(org.hibernate.Session session)