|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | PROPERTY | CONSTR | METHOD | DETAIL: FIELD | PROPERTY | CONSTR | METHOD |
java.lang.Object org.codehaus.groovy.grails.orm.hibernate.cfg.HibernateMappingBuilder
class HibernateMappingBuilder extends java.lang.Object
Implements the ORM mapping DSL constructing a model that can be evaluated by the GrailsDomainBinder class which maps GORM classes onto the database.
Property Summary | |
---|---|
static java.lang.Object |
LOG
|
java.lang.String |
className
|
Mapping |
mapping
|
Constructor Summary | |
HibernateMappingBuilder(java.lang.String className)
Constructor for builder |
Method Summary | |
---|---|
void
|
autoImport(boolean b)
|
void
|
autoTimestamp(boolean b)
Set whether auto time stamping should occur for last_updated and date_created columns |
void
|
batchSize(java.lang.Integer num)
Configures the batch-size used for lazy loading |
void
|
cache(java.util.Map args)
|
void
|
cache(java.lang.String usage)
|
void
|
cache(java.lang.String usage, java.util.Map args)
|
void
|
cache(boolean shouldCache)
|
void
|
columns(groovy.lang.Closure callable)
|
void
|
datasource(java.lang.String name)
|
void
|
datasources(java.util.List names)
|
void
|
discriminator(java.lang.String name)
|
void
|
discriminator(java.util.Map args)
|
void
|
dynamicInsert(boolean b)
Whether to use dynamic update queries |
void
|
dynamicUpdate(boolean b)
Whether to use dynamic update queries |
Mapping
|
evaluate(groovy.lang.Closure mappingClosure, org.springframework.context.ApplicationContext applicationContext = null)
Central entry point for the class. |
void
|
hibernateCustomUserType(java.util.Map args)
|
void
|
id(java.util.Map args)
|
void
|
includes(groovy.lang.Closure callable)
Include another config in this one |
void
|
methodMissing(java.lang.String name, java.lang.Object args)
|
void
|
order(java.lang.String direction)
|
void
|
sort(java.lang.String name)
|
void
|
sort(java.util.Map nameAndDirection)
|
void
|
table(java.lang.String name)
|
void
|
table(java.util.Map tableDef)
|
void
|
tablePerHierarchy(boolean isTablePerHierarchy)
If true the class and its sub classes will be mapped with table per hierarchy mapping |
void
|
tablePerSubclass(boolean isTablePerSubClass)
If true the class and its subclasses will be mapped with table per subclass mapping |
void
|
version(boolean isVersioned)
|
void
|
version(java.lang.String versionColumn)
|
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() |
Property Detail |
---|
static final java.lang.Object LOG
java.lang.String className
Mapping mapping
Constructor Detail |
---|
HibernateMappingBuilder(java.lang.String className)
className
- The name of the class being mapped
Method Detail |
---|
void autoImport(boolean b)
Configures whether to auto import packages domain classes in HQL queries. Default is true
{ autoImport false }
void autoTimestamp(boolean b)
void batchSize(java.lang.Integer num)
num
- The batch size to use
void cache(java.util.Map args)
Configures the second-level cache for the class
{ cache usage:'read-only', include:'all' }
args
- Named arguments that contain the "usage" and/or "include" parameters
void cache(java.lang.String usage)
Configures the second-level cache for the class
{ cache 'read-only' }
usage
- The usage type for the cache which is one of CacheConfig.USAGE_OPTIONS
void cache(java.lang.String usage, java.util.Map args)
Configures the second-level cache for the class
{ cache 'read-only', include:'all }
usage
- The usage type for the cache which is one of CacheConfig.USAGE_OPTIONS
void cache(boolean shouldCache)
Configures the second-level cache with the default usage of 'read-write' and the default include of 'all' if
the passed argument is true
{ cache true }
shouldCache
- True if the default cache configuration should be applied
void columns(groovy.lang.Closure callable)
Consumes the columns closure and populates the value into the Mapping objects columns property
callable
- The closure containing the column definitions
void datasource(java.lang.String name)
void datasources(java.util.List names)
void discriminator(java.lang.String name)
Configures the discriminator name. Example:
{ discriminator 'foo' }
name
- The name of the table
void discriminator(java.util.Map args)
Configures the discriminator name. Example:
{ discriminator name:'foo', column:'type' }
name
- The name of the table
void dynamicInsert(boolean b)
void dynamicUpdate(boolean b)
Mapping evaluate(groovy.lang.Closure mappingClosure, org.springframework.context.ApplicationContext applicationContext = null)
mappingClosure
- The closure that defines the ORM DSL
void hibernateCustomUserType(java.util.Map args)
void id(java.util.Map args)
Configures the identity strategy for the mapping. Examples
{ id generator:'sequence' }
{ id composite: ['one', 'two'] }
args
- The named arguments to the id method
void includes(groovy.lang.Closure callable)
void methodMissing(java.lang.String name, java.lang.Object args)
void order(java.lang.String direction)
Configures the default sort direction. Example:
{ order 'desc' }
name
- The name of the property to sort by
void sort(java.lang.String name)
Configures the default sort column. Example:
{ sort 'foo' }
name
- The name of the property to sort by
void sort(java.util.Map nameAndDirection)
Configures the default sort column. Example:
{ sort foo:'desc' }
name
- The name of the property to sort by
void table(java.lang.String name)
Configures the table name. Example:
{ table 'foo' }
name
- The name of the table
void table(java.util.Map tableDef)
Configures the table name. Example:
{ table name:'foo', schema:'dbo', catalog:'CRM' }
void tablePerHierarchy(boolean isTablePerHierarchy)
void tablePerSubclass(boolean isTablePerSubClass)
void version(boolean isVersioned)
Configures whether to use versioning for optimistic locking
{ version false }
isVersioned
- True if a version property should be configured
void version(java.lang.String versionColumn)
Configures the name of the version column
{ version 'foo' }
isVersioned
- True if a version property should be configured
Groovy Documentation