|
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)
Returns the proxy for a given association or null if it is not proxied |
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)
Retrieves the fetch mode for the specified instance; otherwise returns the default FetchMode. |
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)
Checks whether an associated property is initialized and returns true if it is |
static boolean
|
isMappedWithHibernate(GrailsDomainClass domainClass)
|
static void
|
populateArgumentsForCriteria(GrailsApplication grailsApplication, 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(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)
Sets the target object to read-write, allowing Hibernate to dirty check it and auto-flush changes. |
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), java.lang.Object#wait(long, int), 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(@SuppressWarnings("unused") GrailsApplication grailsApplication, java.lang.Class targetClass, org.hibernate.Criteria criteria)
public static void configureHibernateDomainClasses(org.hibernate.SessionFactory sessionFactory, java.lang.String sessionFactoryName, GrailsApplication application)
@SuppressWarnings("rawtypes") 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)
obj
- The objectassociationName
- The named assoication
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)
object
- The object, converted to a string
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)
obj
- The name of the objectassociationName
- The name of the association
public static boolean isMappedWithHibernate(GrailsDomainClass domainClass)
@SuppressWarnings("rawtypes") public static void populateArgumentsForCriteria(GrailsApplication grailsApplication, java.lang.Class targetClass, org.hibernate.Criteria c, java.util.Map argMap)
grailsApplication
- the GrailsApplication instancetargetClass
- The target classc
- The criteria instanceargMap
- The arguments map
@Deprecated @SuppressWarnings("rawtypes") 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
@SuppressWarnings("rawtypes") public static void populateArgumentsForCriteria(org.hibernate.Criteria c, java.util.Map argMap)
public static void setObjectToReadWrite(java.lang.Object target, org.hibernate.SessionFactory sessionFactory)
target
- The target objectsessionFactory
- The SessionFactory instance
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