public class GrailsHibernateUtil extends HibernateRuntimeUtils
Utility methods for configuring Hibernate inside Grails.
Modifiers | Name | Description |
---|---|---|
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.Class<?>[] |
EMPTY_CLASS_ARRAY |
|
protected static org.slf4j.Logger |
LOG |
|
static java.lang.String |
ORDER_ASC |
|
static java.lang.String |
ORDER_DESC |
Type Params | Return Type | Name and description |
---|---|---|
|
public static void |
cacheCriteriaByMapping(java.lang.Class<?> targetClass, org.hibernate.Criteria criteria) Configures the criteria instance to cache based on the configured mapping. |
|
public static void |
cacheCriteriaByMapping(AbstractHibernateDatastore datastore, java.lang.Class<?> targetClass, org.hibernate.Criteria criteria) |
|
public static void |
ensureCorrectGroovyMetaClass(java.lang.Object target, java.lang.Class<?> persistentClass) Ensures the meta class is correct for a given class |
|
public 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 |
|
public static java.util.List<java.lang.String> |
getDatasourceNames(PersistentEntity domainClass)
|
|
public static java.lang.String |
getDefaultDataSource(PersistentEntity domainClass)
|
|
public static org.hibernate.FetchMode |
getFetchMode(java.lang.Object object) Retrieves the fetch mode for the specified instance; otherwise returns the default FetchMode. |
|
public static void |
incrementVersion(java.lang.Object target) Increments the entities version number in order to force an update |
|
public static boolean |
isInitialized(java.lang.Object obj, java.lang.String associationName) Checks whether an associated property is initialized and returns true if it is |
|
public static boolean |
isMappedWithHibernate(PersistentEntity domainClass) |
|
public static boolean |
isNotEmpty(java.lang.String string) |
|
public static void |
populateArgumentsForCriteria(AbstractHibernateDatastore datastore, java.lang.Class<?> targetClass, org.hibernate.Criteria c, java.util.Map argMap, org.springframework.core.convert.ConversionService conversionService) |
|
public static void |
populateArgumentsForCriteria(AbstractHibernateDatastore datastore, java.lang.Class<?> targetClass, org.hibernate.Criteria c, java.util.Map argMap, org.springframework.core.convert.ConversionService conversionService, boolean useDefaultMapping) Populates criteria arguments for the given target class and arguments map |
|
public static void |
populateArgumentsForCriteria(java.lang.Class<?> targetClass, org.hibernate.Criteria c, java.util.Map argMap, org.springframework.core.convert.ConversionService conversionService) Populates criteria arguments for the given target class and arguments map |
|
public static void |
populateArgumentsForCriteria(org.hibernate.Criteria c, java.util.Map argMap, org.springframework.core.convert.ConversionService conversionService) |
|
public static java.lang.String |
qualify(java.lang.String prefix, java.lang.String name) |
|
public static void |
setBinder(GrailsDomainBinder binder)
|
|
public 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. |
|
public static void |
setObjectToReadyOnly(java.lang.Object target, org.hibernate.SessionFactory sessionFactory) Sets the target object to read-only using the given SessionFactory instance. |
|
public static java.lang.String |
unqualify(java.lang.String qualifiedName) |
|
public static java.lang.Object |
unwrapIfProxy(java.lang.Object instance) Unproxies a HibernateProxy. |
|
public static java.lang.Object |
unwrapProxy(org.hibernate.proxy.HibernateProxy proxy) Unwraps and initializes a HibernateProxy. |
|
public static boolean |
usesDatasource(PersistentEntity domainClass, java.lang.String dataSourceName)
|
Methods inherited from class | Name |
---|---|
class HibernateRuntimeUtils |
autoAssociateBidirectionalOneToOnes, convertValueToType, enableDynamicFilterEnablerIfPresent, setupErrorsProperty |
Configures the criteria instance to cache based on the configured mapping.
targetClass
- The target classcriteria
- The criteriaEnsures the meta class is correct for a given class
target
- The GroovyObjectpersistentClass
- The persistent classReturns the proxy for a given association or null if it is not proxied
obj
- The objectassociationName
- The named assoicationRetrieves the fetch mode for the specified instance; otherwise returns the default FetchMode.
object
- The object, converted to a stringIncrements the entities version number in order to force an update
target
- The target entityChecks whether an associated property is initialized and returns true if it is
obj
- The name of the objectassociationName
- The name of the associationPopulates criteria arguments for the given target class and arguments map
datastore
- the GrailsApplication instancetargetClass
- The target classc
- The criteria instanceargMap
- The arguments mapPopulates criteria arguments for the given target class and arguments map
targetClass
- The target classc
- The criteria instanceargMap
- The arguments mapSets the target object to read-write, allowing Hibernate to dirty check it and auto-flush changes.
target
- The target objectsessionFactory
- The SessionFactory instanceSets the target object to read-only using the given SessionFactory instance. This avoids Hibernate performing any dirty checking on the object
target
- The target objectsessionFactory
- The SessionFactory instanceUnproxies a HibernateProxy. If the proxy is uninitialized, it automatically triggers an initialization. In case the supplied object is null or not a proxy, the object will be returned as-is.
Unwraps and initializes a HibernateProxy.
proxy
- The proxy