Groovy Documentation

org.codehaus.groovy.grails.orm.hibernate.cfg
[Java] Class GrailsDomainBinder

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.

Authors:
Graeme Rocher
Since:
0.1


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)

protected static void bindNumericColumnConstraints(org.hibernate.mapping.Column column, ConstrainedProperty constrainedProperty)

static void bindRoot(GrailsDomainClass domainClass, org.hibernate.cfg.Mappings mappings, java.lang.String sessionFactoryBeanName)

protected static void bindStringColumnConstraints(org.hibernate.mapping.Column column, ConstrainedProperty constrainedProperty)

@return the maximum length of the strings in the specified list

static void clearMappingCache()

static void clearMappingCache(java.lang.Class theClass)

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)

static Mapping evaluateMapping(GrailsDomainClass domainClass)

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)

static PropertyConfig getPropertyConfig(GrailsDomainClassProperty property)

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long, int), java.lang.Object#wait(long), 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

NAMING_STRATEGIES

public static java.util.Map NAMING_STRATEGIES
Overrideable naming strategy. Defaults to ImprovedNamingStrategy but can be configured in DataSource.groovy via hibernate.naming_strategy = ....


 
Method Detail

bindClass

public static void bindClass(GrailsDomainClass domainClass, org.hibernate.cfg.Mappings mappings, java.lang.String sessionFactoryBeanName)


bindNumericColumnConstraints

protected static void bindNumericColumnConstraints(org.hibernate.mapping.Column column, ConstrainedProperty constrainedProperty)


bindRoot

public static void bindRoot(GrailsDomainClass domainClass, org.hibernate.cfg.Mappings mappings, java.lang.String sessionFactoryBeanName)


bindStringColumnConstraints

protected static void bindStringColumnConstraints(org.hibernate.mapping.Column column, ConstrainedProperty constrainedProperty)
Returns:
the maximum length of the strings in the specified list


clearMappingCache

public static void clearMappingCache()


clearMappingCache

public static void clearMappingCache(java.lang.Class theClass)


configureNamingStrategy

public static void configureNamingStrategy(java.lang.Object strategy)
Override the default naming strategy for the default datasource given a Class or a full class name.
throws:
ClassNotFoundException
throws:
InstantiationException
throws:
IllegalAccessException
Parameters:
strategy - the class or name


configureNamingStrategy

public 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.
throws:
ClassNotFoundException
throws:
InstantiationException
throws:
IllegalAccessException
Parameters:
datasourceName - the datasource name
strategy - the class, name, or instance


createClassProperties

protected static void createClassProperties(GrailsDomainClass domainClass, org.hibernate.mapping.PersistentClass persistentClass, org.hibernate.cfg.Mappings mappings, java.lang.String sessionFactoryBeanName)


evaluateMapping

public static Mapping evaluateMapping(GrailsDomainClass domainClass)


evaluateMapping

public static Mapping evaluateMapping(GrailsDomainClass domainClass, groovy.lang.Closure defaultMapping)


evaluateMapping

public static Mapping evaluateMapping(GrailsDomainClass domainClass, groovy.lang.Closure defaultMapping, boolean cache)


getMapping

public static Mapping getMapping(java.lang.Class theClass)
Obtains a mapping object for the given domain class nam
Parameters:
theClass - The domain class in question
Returns:
A Mapping object or null


getMapping

public static Mapping getMapping(GrailsDomainClass domainClass)


getPropertyConfig

public static PropertyConfig getPropertyConfig(GrailsDomainClassProperty property)


 

Groovy Documentation