class HibernateMappingBuilder extends java.lang.Object implements MappingConfigurationBuilder<Mapping, PropertyConfig>
Implements the ORM mapping DSL constructing a model that can be evaluated by the GrailsDomainBinder class which maps GORM classes onto the database.
Modifiers | Name | Description |
---|---|---|
class |
HibernateMappingBuilder.1 |
Type | Name and description |
---|---|
static org.slf4j.Logger |
LOG |
java.lang.String |
className |
groovy.lang.Closure |
defaultConstraints |
Mapping |
mapping |
Constructor and description |
---|
HibernateMappingBuilder
(java.lang.String className) Constructor for builder |
HibernateMappingBuilder
(Mapping mapping, java.lang.String className, groovy.lang.Closure defaultConstraints) |
Type Params | Return Type | Name and description |
---|---|---|
|
void |
autoImport(boolean b) |
|
void |
autoTimestamp(boolean b) Set whether auto time stamping should occur for last_updated and date_created columns |
|
void |
autowire(boolean autowire) |
|
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 |
comment(java.lang.String comment) |
|
void |
datasource(java.lang.String name) |
|
void |
datasources(java.util.List<java.lang.String> 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, java.lang.Object context) Central entry point for the class. |
|
java.util.Map<java.lang.String, PropertyConfig> |
getProperties() |
|
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 namesAndDirections) |
|
void |
table(java.lang.String name) |
|
void |
table(java.util.Map tableDef) |
|
void |
tablePerConcreteClass(boolean isTablePerConcreteClass) If true the class and its subclasses will be mapped with table per subclass mapping |
|
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 |
tenantId(java.lang.String tenantIdProperty) Sets the tenant id |
|
void |
version(boolean isVersioned) |
|
void |
version(java.lang.String versionColumn) |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), 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() |
Constructor for builder
className
- The name of the class being mapped
Configures whether to auto import packages domain classes in HQL queries. Default is true
{ autoImport false }
Set whether auto time stamping should occur for last_updated and date_created columns
Configures the batch-size used for lazy loading
num
- The batch size to use
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
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
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
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
Consumes the columns closure and populates the value into the Mapping objects columns property
callable
- The closure containing the column definitions
Configures the discriminator name. Example:
{ discriminator 'foo' }
name
- The name of the table
Configures the discriminator name. Example:
{ discriminator value:'foo', column:'type' }
name
- The name of the table
Whether to use dynamic update queries
Whether to use dynamic update queries
Central entry point for the class. Passing a closure that defines a set of mappings will evaluate said mappings and populate the "mapping" property of this class which can then be obtained with getMappings()
mappingClosure
- The closure that defines the ORM DSL
Configures the identity strategy for the mapping. Examples
{ id generator:'sequence' }
{ id composite: ['one', 'two'] }
args
- The named arguments to the id methodInclude another config in this one
Configures the default sort direction. Example:
{ order 'desc' }
name
- The name of the property to sort by
Configures the default sort column. Example:
{ sort 'foo' }
name
- The name of the property to sort by
Configures the default sort column. Example:
{ sort foo:'desc' }
namesAndDirections
- The names and directions of the property to sort by
Configures the table name. Example:
{ table 'foo' }
name
- The name of the table
Configures the table name. Example:
{ table name:'foo', schema:'dbo', catalog:'CRM' }
If true the class and its subclasses will be mapped with table per subclass mapping
If true the class and its sub classes will be mapped with table per hierarchy mapping
If true the class and its subclasses will be mapped with table per subclass mapping
Sets the tenant id
tenantIdProperty
- The tenant id property
Configures whether to use versioning for optimistic locking
{ version false }
isVersioned
- True if a version property should be configured
Configures the name of the version column
{ version 'foo' }
isVersioned
- True if a version property should be configured
Groovy Documentation