|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsHibernateUtil
public class GrailsHibernateUtil extends java.lang.Object
Utility methods for configuring Hibernate inside Grails.
Field Summary | |
---|---|
static java.lang.String |
ARGUMENT_CACHE
|
static java.lang.String |
ARGUMENT_FETCH
|
static java.lang.String |
ARGUMENT_FETCH_SIZE
|
static java.lang.String |
ARGUMENT_FLUSH_MODE
|
static java.lang.String |
ARGUMENT_IGNORE_CASE
|
static java.lang.String |
ARGUMENT_LOCK
|
static java.lang.String |
ARGUMENT_MAX
|
static java.lang.String |
ARGUMENT_OFFSET
|
static java.lang.String |
ARGUMENT_ORDER
|
static java.lang.String |
ARGUMENT_READ_ONLY
|
static java.lang.String |
ARGUMENT_SORT
|
static java.lang.String |
ARGUMENT_TIMEOUT
|
static java.lang.String |
CONFIG_PROPERTY_CACHE_QUERIES
|
static java.lang.Class[] |
EMPTY_CLASS_ARRAY
|
static java.lang.String |
ORDER_ASC
|
static java.lang.String |
ORDER_DESC
|
Method Summary | |
---|---|
static void
|
autoAssociateBidirectionalOneToOnes(DefaultGrailsDomainClass domainClass, java.lang.Object target)
|
static GroovyAwareJavassistProxyFactory
|
buildProxyFactory(org.hibernate.mapping.PersistentClass persistentClass)
|
static void
|
cacheCriteriaByMapping(java.lang.Class targetClass, org.hibernate.Criteria criteria)
Configures the criteria instance to cache based on the configured mapping. |
static void
|
cacheCriteriaByMapping(GrailsApplication grailsApplication, java.lang.Class targetClass, org.hibernate.Criteria criteria)
|
static void
|
configureHibernateDomainClasses(org.hibernate.SessionFactory sessionFactory, java.lang.String sessionFactoryName, GrailsApplication application)
|
static void
|
configureInheritanceMappings(java.util.Map hibernateDomainClassMap)
|
static void
|
enableDynamicFilterEnablerIfPresent(org.hibernate.SessionFactory sessionFactory, org.hibernate.Session session)
|
static void
|
ensureCorrectGroovyMetaClass(java.lang.Object target, java.lang.Class persistentClass)
Ensures the meta class is correct for a given class |
static org.hibernate.proxy.HibernateProxy
|
getAssociationProxy(java.lang.Object obj, java.lang.String associationName)
|
static java.util.List
|
getDatasourceNames(GrailsDomainClass domainClass)
|
static java.lang.String
|
getDefaultDataSource(GrailsDomainClass domainClass)
If a domain class uses more than one datasource, we need to know which one to use when calling a method without a namespace qualifier. |
static org.hibernate.FetchMode
|
getFetchMode(java.lang.Object object)
|
static void
|
incrementVersion(java.lang.Object target)
Increments the entities version number in order to force an update |
static boolean
|
isCacheQueriesByDefault()
|
static boolean
|
isCacheQueriesByDefault(GrailsApplication grailsApplication)
|
static boolean
|
isInitialized(java.lang.Object obj, java.lang.String associationName)
|
static boolean
|
isMappedWithHibernate(GrailsDomainClass domainClass)
|
static void
|
populateArgumentsForCriteria(GrailsApplication grailsApplication, java.lang.Class targetClass, org.hibernate.Criteria c, java.util.Map argMap)
|
static void
|
populateArgumentsForCriteria(GrailsApplication grailsApplication, java.lang.Class targetClass, org.hibernate.Criteria c, java.util.Map argMap, boolean includeDefaultMapping)
Populates criteria arguments for the given target class and arguments map |
static void
|
populateArgumentsForCriteria(java.lang.Class targetClass, org.hibernate.Criteria c, java.util.Map argMap)
Populates criteria arguments for the given target class and arguments map |
static void
|
populateArgumentsForCriteria(org.hibernate.Criteria c, java.util.Map argMap)
|
static void
|
setObjectToReadWrite(java.lang.Object target, org.hibernate.SessionFactory sessionFactory)
|
static void
|
setObjectToReadyOnly(java.lang.Object target, org.hibernate.SessionFactory sessionFactory)
Sets the target object to read-only using the given SessionFactory instance. |
static java.lang.Object
|
unwrapIfProxy(java.lang.Object instance)
|
static java.lang.Object
|
unwrapProxy(org.hibernate.proxy.HibernateProxy proxy)
Unwraps and initializes a HibernateProxy. |
static boolean
|
usesDatasource(GrailsDomainClass domainClass, java.lang.String dataSourceName)
|
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(), java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Field Detail |
---|
public static final java.lang.String ARGUMENT_CACHE
public static final java.lang.String ARGUMENT_FETCH
public static final java.lang.String ARGUMENT_FETCH_SIZE
public static final java.lang.String ARGUMENT_FLUSH_MODE
public static final java.lang.String ARGUMENT_IGNORE_CASE
public static final java.lang.String ARGUMENT_LOCK
public static final java.lang.String ARGUMENT_MAX
public static final java.lang.String ARGUMENT_OFFSET
public static final java.lang.String ARGUMENT_ORDER
public static final java.lang.String ARGUMENT_READ_ONLY
public static final java.lang.String ARGUMENT_SORT
public static final java.lang.String ARGUMENT_TIMEOUT
public static final java.lang.String CONFIG_PROPERTY_CACHE_QUERIES
public static final java.lang.Class[] EMPTY_CLASS_ARRAY
public static final java.lang.String ORDER_ASC
public static final java.lang.String ORDER_DESC
Method Detail |
---|
public static void autoAssociateBidirectionalOneToOnes(DefaultGrailsDomainClass domainClass, java.lang.Object target)
public static GroovyAwareJavassistProxyFactory buildProxyFactory(org.hibernate.mapping.PersistentClass persistentClass)
public static void cacheCriteriaByMapping(java.lang.Class targetClass, org.hibernate.Criteria criteria)
targetClass
- The target classcriteria
- The criteria
public static void cacheCriteriaByMapping(teria(Criteria c, Map argMap GrailsApplication grailsApplication, java.lang.Class targetClass, org.hibernate.Criteria criteria)
public static void configureHibernateDomainClasses(org.hibernate.SessionFactory sessionFactory, java.lang.String sessionFactoryName, GrailsApplication application)
public static void configureInheritanceMappings(Map hibernateDomainClassMap) { public static void configureInheritanceMappings(java.util.Map hibernateDomainClassMap)
@SuppressWarnings("rawtypes") public static void enableDynamicFilterEnablerIfPresent(org.hibernate.SessionFactory sessionFactory, org.hibernate.Session session)
public static void ensureCorrectGroovyMetaClass(java.lang.Object target, java.lang.Class persistentClass)
target
- The GroovyObjectpersistentClass
- The persistent class
public static org.hibernate.proxy.HibernateProxy getAssociationProxy(java.lang.Object obj, java.lang.String associationName)
public static java.util.List getDatasourceNames(GrailsDomainClass domainClass)
public static java.lang.String getDefaultDataSource(GrailsDomainClass domainClass)
domainClass
- the domain class
public static org.hibernate.FetchMode getFetchMode(java.lang.Object object)
public static void incrementVersion(java.lang.Object target)
target
- The target entity
public static boolean isCacheQueriesByDefault()
public static boolean isCacheQueriesByDefault(GrailsApplication grailsApplication)
public static boolean isInitialized(java.lang.Object obj, java.lang.String associationName)
public static boolean isMappedWithHibernate(GrailsDomainClass domainClass)
public static void populateArgumentsForCriteria(GrailsApplication grailsApplication, java.lang.Class targetClass, org.hibernate.Criteria c, java.util.Map argMap)
Integer offsetParam = null; public static void populateArgumentsForCriteria(GrailsApplication grailsApplication, java.lang.Class targetClass, org.hibernate.Criteria c, java.util.Map argMap, boolean includeDefaultMapping)
grailsApplication
- the GrailsApplication instancetargetClass
- The target classc
- The criteria instanceargMap
- The arguments map
populateArgumentsForCriteria(null, targetClass, c, argMap); } public static void populateArgumentsForCriteria(java.lang.Class targetClass, org.hibernate.Criteria c, java.util.Map argMap)
targetClass
- The target classc
- The criteria instanceargMap
- The arguments map
* Retrieves the fetch mode for the specified instance; otherwise returns the default FetchMode. public static void populateArgumentsForCriteria(org.hibernate.Criteria c, java.util.Map argMap)
public static void setObjectToReadWrite(java.lang.Object target, org.hibernate.SessionFactory sessionFactory)
public static void setObjectToReadyOnly(java.lang.Object target, org.hibernate.SessionFactory sessionFactory)
target
- The target objectsessionFactory
- The SessionFactory instance
public static java.lang.Object unwrapIfProxy(java.lang.Object instance)
public static java.lang.Object unwrapProxy(org.hibernate.proxy.HibernateProxy proxy)
proxy
- The proxy
public static boolean usesDatasource(GrailsDomainClass domainClass, java.lang.String dataSourceName)
Groovy Documentation