|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainBinder
public final class GrailsDomainBinder extends java.lang.Object
Handles the binding Grails domain classes and properties to the Hibernate runtime meta model. Based on the HbmBinder code in Hibernate core and influenced by AnnotationsBinder.
Field Summary | |
---|---|
static java.util.Map |
NAMING_STRATEGIES
Overrideable naming strategy. |
Method Summary | |
---|---|
static void
|
bindClass(GrailsDomainClass domainClass, org.hibernate.cfg.Mappings mappings, java.lang.String sessionFactoryBeanName)
Binds a Grails domain class to the Hibernate runtime meta model |
protected static void
|
bindNumericColumnConstraints(org.hibernate.mapping.Column column, ConstrainedProperty constrainedProperty)
Interrogates the specified constraints looking for any constraints that would limit the precision and/or scale of the property's value. |
static void
|
bindRoot(GrailsDomainClass domainClass, org.hibernate.cfg.Mappings mappings, java.lang.String sessionFactoryBeanName)
Binds a root class (one with no super classes) to the runtime meta model based on the supplied Grails domain class |
protected static void
|
bindStringColumnConstraints(org.hibernate.mapping.Column column, ConstrainedProperty constrainedProperty)
Interrogates the specified constraints looking for any constraints that would limit the length of the property's value. |
static void
|
configureNamingStrategy(java.lang.Object strategy)
Override the default naming strategy for the default datasource given a Class or a full class name. |
static void
|
configureNamingStrategy(java.lang.String datasourceName, java.lang.Object strategy)
Override the default naming strategy given a Class or a full class name, or an instance of a NamingStrategy. |
protected static void
|
createClassProperties(GrailsDomainClass domainClass, org.hibernate.mapping.PersistentClass persistentClass, org.hibernate.cfg.Mappings mappings, java.lang.String sessionFactoryBeanName)
Creates and binds the properties for the specified Grails domain class and PersistentClass and binds them to the Hibernate runtime meta model |
static Mapping
|
evaluateMapping(GrailsDomainClass domainClass)
Evaluates a Mapping object from the domain class if it has a mapping closure |
static Mapping
|
evaluateMapping(GrailsDomainClass domainClass, groovy.lang.Closure defaultMapping)
|
static Mapping
|
evaluateMapping(GrailsDomainClass domainClass, groovy.lang.Closure defaultMapping, boolean cache)
|
static Mapping
|
getMapping(java.lang.Class theClass)
Obtains a mapping object for the given domain class nam |
static Mapping
|
getMapping(GrailsDomainClass domainClass)
Obtains a mapping object for the given domain class nam |
static PropertyConfig
|
getPropertyConfig(GrailsDomainClassProperty property)
|
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 java.util.Map NAMING_STRATEGIES
ImprovedNamingStrategy
but can
be configured in DataSource.groovy via hibernate.naming_strategy = ...
.
Method Detail |
---|
public static void bindClass(GrailsDomainClass domainClass, org.hibernate.cfg.Mappings mappings, java.lang.String sessionFactoryBeanName)
domainClass
- The domain class to bindmappings
- The existing mappingssessionFactoryBeanName
- the session factory bean name
protected static void bindNumericColumnConstraints(org.hibernate.mapping.Column column, ConstrainedProperty constrainedProperty)
column
- the column that corresponds to the propertyconstrainedProperty
- the property's constraints
public static void bindRoot(GrailsDomainClass domainClass, org.hibernate.cfg.Mappings mappings, java.lang.String sessionFactoryBeanName)
domainClass
- The Grails domain classmappings
- The Hibernate Mappings objectsessionFactoryBeanName
- the session factory bean name
protected static void bindStringColumnConstraints(org.hibernate.mapping.Column column, ConstrainedProperty constrainedProperty)
column
- the column that corresponds to the propertyconstrainedProperty
- the property's constraints
public static void configureNamingStrategy(java.lang.Object strategy)
strategy
- the class or name
public static void configureNamingStrategy(java.lang.String datasourceName, java.lang.Object strategy)
datasourceName
- the datasource namestrategy
- the class, name, or instance
protected static void createClassProperties(GrailsDomainClass domainClass, org.hibernate.mapping.PersistentClass persistentClass, org.hibernate.cfg.Mappings mappings, java.lang.String sessionFactoryBeanName)
domainClass
- The Grails domain classpersistentClass
- The Hibernate PersistentClass instancemappings
- The Hibernate Mappings instancesessionFactoryBeanName
- the session factory bean name
public static Mapping evaluateMapping(GrailsDomainClass domainClass)
domainClass
- The domain class
public static Mapping evaluateMapping(GrailsDomainClass domainClass, groovy.lang.Closure defaultMapping)
public static Mapping evaluateMapping(GrailsDomainClass domainClass, groovy.lang.Closure defaultMapping, boolean cache)
public static Mapping getMapping(java.lang.Class theClass)
theClass
- The domain class in question
public static Mapping getMapping(GrailsDomainClass domainClass)
domainClass
- The domain class in question
public static PropertyConfig getPropertyConfig(GrailsDomainClassProperty property)
Groovy Documentation