|
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
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_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_SORT
|
static java.lang.String |
CONFIG_PROPERTY_CACHE_QUERIES
|
static Class[] |
EMPTY_CLASS_ARRAY
|
static java.lang.String |
ORDER_ASC
|
static java.lang.String |
ORDER_DESC
|
static SimpleTypeConverter |
converter
|
Method Summary | |
---|---|
static GroovyAwareJavassistProxyFactory
|
buildProxyFactory(PersistentClass persistentClass)
|
static void
|
cacheCriteriaByMapping(java.lang.Class targetClass, Criteria criteria)
Configures the criteria instance to cache based on the configured mapping. |
static void
|
configureHibernateDomainClasses(SessionFactory sessionFactory, GrailsApplication application)
|
static void
|
configureInheritanceMappings(java.util.Map hibernateDomainClassMap)
|
static void
|
enableDynamicFilterEnablerIfPresent(SessionFactory sessionFactory, Session session)
|
static void
|
ensureCorrectGroovyMetaClass(java.lang.Object target, java.lang.Class persistentClass)
Ensures the meta class is correct for a given class |
static 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 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
|
isInitialized(java.lang.Object obj, java.lang.String associationName)
Checks whether an associated property is initialized and returns true if it is |
static void
|
populateArgumentsForCriteria(java.lang.Class targetClass, Criteria c, java.util.Map argMap)
|
static void
|
populateArgumentsForCriteria(Criteria c, java.util.Map argMap)
|
static void
|
setObjectToReadWrite(java.lang.Object target, 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, 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(HibernateProxy proxy)
Unwraps and initializes a HibernateProxy. |
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_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_SORT
public static final java.lang.String CONFIG_PROPERTY_CACHE_QUERIES
public static final Class[] EMPTY_CLASS_ARRAY
public static final java.lang.String ORDER_ASC
public static final java.lang.String ORDER_DESC
public static SimpleTypeConverter converter
Method Detail |
---|
@SuppressWarnings("serial") public static GroovyAwareJavassistProxyFactory buildProxyFactory(PersistentClass persistentClass)
public static void cacheCriteriaByMapping(java.lang.Class targetClass, Criteria criteria)
targetClass
- The target classcriteria
- The criteria
@SuppressWarnings("rawtypes") public static void configureHibernateDomainClasses(SessionFactory sessionFactory, GrailsApplication application)
@SuppressWarnings("rawtypes") public static void configureInheritanceMappings(java.util.Map hibernateDomainClassMap)
public static void enableDynamicFilterEnablerIfPresent(SessionFactory sessionFactory, Session session)
public static void ensureCorrectGroovyMetaClass(java.lang.Object target, java.lang.Class persistentClass)
target
- The GroovyObjectpersistentClass
- The persistent class
public static HibernateProxy getAssociationProxy(java.lang.Object obj, java.lang.String associationName)
obj
- The objectassociationName
- The named assoication
public static 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 isInitialized(java.lang.Object obj, java.lang.String associationName)
obj
- The name of the objectassociationName
- The name of the association
@SuppressWarnings("rawtypes") public static void populateArgumentsForCriteria(java.lang.Class targetClass, Criteria c, java.util.Map argMap)
@SuppressWarnings("rawtypes") public static void populateArgumentsForCriteria(Criteria c, java.util.Map argMap)
public static void setObjectToReadWrite(java.lang.Object target, SessionFactory sessionFactory)
target
- The target objectsessionFactory
- The SessionFactory instance
public static void setObjectToReadyOnly(java.lang.Object target, 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(HibernateProxy proxy)
proxy
- The proxy
Groovy Documentation