|
||||||||||
PREV CLASS NEXT CLASS | 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
A class containing utility methods for configuring Hibernate inside Grails
Field Summary | |
---|---|
static String |
ARGUMENT_CACHE
|
static String |
ARGUMENT_FETCH
|
static String |
ARGUMENT_IGNORE_CASE
|
static String |
ARGUMENT_LOCK
|
static String |
ARGUMENT_MAX
|
static String |
ARGUMENT_OFFSET
|
static String |
ARGUMENT_ORDER
|
static String |
ARGUMENT_SORT
|
static String |
CONFIG_PROPERTY_CACHE_QUERIES
|
static SimpleTypeConverter |
converter
|
static Class[] |
EMPTY_CLASS_ARRAY
|
static String |
ORDER_ASC
|
static String |
ORDER_DESC
|
Constructor Summary | |
---|---|
GrailsHibernateUtil()
|
Method Summary | |
---|---|
static GroovyAwareJavassistProxyFactory |
buildProxyFactory(org.hibernate.mapping.PersistentClass persistentClass)
|
static void |
cacheCriteriaByMapping(Class targetClass,
org.hibernate.Criteria criteria)
Configures the criteria instance to cache based on the configured mapping |
static void |
configureHibernateDomainClasses(org.hibernate.SessionFactory sessionFactory,
GrailsApplication application)
|
static void |
configureInheritanceMappings(Map hibernateDomainClassMap)
|
static org.hibernate.proxy.HibernateProxy |
getAssociationProxy(Object obj,
String associationName)
Returns the proxy for a given association or null if it is not proxied |
static org.hibernate.FetchMode |
getFetchMode(Object object)
Will retrieve the fetch mode for the specified instance other wise return the default FetchMode |
static void |
incrementVersion(Object target)
Increments the entities version number in order to force an update |
static boolean |
isCacheQueriesByDefault()
|
static boolean |
isInitialized(Object obj,
String associationName)
Checks whether an associated property is initialized and returns true if it is |
static void |
populateArgumentsForCriteria(Class targetClass,
org.hibernate.Criteria c,
Map argMap)
|
static void |
populateArgumentsForCriteria(org.hibernate.Criteria c,
Map argMap)
|
static void |
setObjectToReadWrite(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(Object target,
org.hibernate.SessionFactory sessionFactory)
Sets the target object to read-only using the given SessionFactory instance. |
static Object |
unwrapIfProxy(Object instance)
|
static Object |
unwrapProxy(org.hibernate.proxy.HibernateProxy proxy)
Unwraps and initializes a HibernateProxy |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static SimpleTypeConverter converter
public static final String ARGUMENT_MAX
public static final String ARGUMENT_OFFSET
public static final String ARGUMENT_ORDER
public static final String ARGUMENT_SORT
public static final String ORDER_DESC
public static final String ORDER_ASC
public static final String ARGUMENT_FETCH
public static final String ARGUMENT_IGNORE_CASE
public static final String ARGUMENT_CACHE
public static final String ARGUMENT_LOCK
public static final String CONFIG_PROPERTY_CACHE_QUERIES
public static final Class[] EMPTY_CLASS_ARRAY
Constructor Detail |
---|
public GrailsHibernateUtil()
Method Detail |
---|
public static void configureHibernateDomainClasses(org.hibernate.SessionFactory sessionFactory, GrailsApplication application)
public static void configureInheritanceMappings(Map hibernateDomainClassMap)
public static void populateArgumentsForCriteria(Class targetClass, org.hibernate.Criteria c, Map argMap)
public static void cacheCriteriaByMapping(Class targetClass, org.hibernate.Criteria criteria)
targetClass
- The target classcriteria
- The criteriapublic static void populateArgumentsForCriteria(org.hibernate.Criteria c, Map argMap)
public static org.hibernate.FetchMode getFetchMode(Object object)
object
- The object, converted to a string
public static void setObjectToReadyOnly(Object target, org.hibernate.SessionFactory sessionFactory)
target
- The target objectsessionFactory
- The SessionFactory instancesetObjectToReadWrite(Object, org.hibernate.SessionFactory)
public static void setObjectToReadWrite(Object target, org.hibernate.SessionFactory sessionFactory)
target
- The target objectsessionFactory
- The SessionFactory instancesetObjectToReadyOnly(Object, org.hibernate.SessionFactory)
public static void incrementVersion(Object target)
target
- The target entitypublic static Object unwrapProxy(org.hibernate.proxy.HibernateProxy proxy)
proxy
- The proxypublic static org.hibernate.proxy.HibernateProxy getAssociationProxy(Object obj, String associationName)
obj
- The objectassociationName
- The named assoication
public static boolean isInitialized(Object obj, String associationName)
obj
- The name of the objectassociationName
- The name of the association
public static boolean isCacheQueriesByDefault()
public static GroovyAwareJavassistProxyFactory buildProxyFactory(org.hibernate.mapping.PersistentClass persistentClass)
public static Object unwrapIfProxy(Object instance)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |