@groovy.transform.CompileStatic @groovy.transform.builder.Builder(builderStrategy: SimpleStrategy, prefix: ) class Mapping extends Entity<PropertyConfig>
Models the mapping from GORM classes to the db.
Type | Name and description |
---|---|
boolean |
autoImport Sets whether packaged domain classes should be auto-imported in HQL queries |
java.lang.Integer |
batchSize The batch size to use for lazy loading |
CacheConfig |
cache Caching config |
java.util.Map<java.lang.String, PropertyConfig> |
columns The configuration for each property |
java.lang.String |
comment DDL comment. |
DiscriminatorConfig |
discriminator Value used to discriminate entities in table-per-hierarchy inheritance mapping |
boolean |
dynamicInsert Whether to use dynamically created insert queries, at the cost of some performance |
boolean |
dynamicUpdate Whether to use dynamically created update queries, at the cost of some performance |
Property |
identity The identity definition |
SortConfig |
sort Used to hold the names and directions of the default property to sort by |
Table |
table The table |
java.lang.String |
tableName |
boolean |
tablePerConcreteClass Sets whether to use table-per-concrete-class or table-per-subclass mapping |
boolean |
tablePerConcreteClass |
boolean |
tablePerHierarchy Sets whether to use table-per-hierarchy or table-per-subclass mapping |
java.util.Map |
userTypes Custom hibernate user types |
boolean |
versioned Whether the class is versioned for optimistic locking |
Constructor and description |
---|
Mapping
() |
Type Params | Return Type | Name and description |
---|---|---|
|
Mapping |
cache(groovy.lang.Closure cacheConfig) Define the cache config |
|
Mapping |
cache(java.util.Map cacheConfig) Define the cache config |
|
Mapping |
cache(java.lang.String usage) Define the cache config |
|
protected PropertyConfig |
cloneGlobalConstraint() |
|
CompositeIdentity |
composite(java.lang.String[] propertyNames) Define a new composite id |
|
static Mapping |
configureExisting(Mapping mapping, java.util.Map config) Configures an existing Mapping instance |
|
static Mapping |
configureExisting(Mapping mapping, groovy.lang.Closure config) Configures an existing Mapping instance |
|
static Mapping |
configureNew(groovy.lang.Closure config) Configures a new Mapping instance |
|
Mapping |
discriminator(groovy.lang.Closure discriminatorDef) Configures the discriminator |
|
Mapping |
discriminator(java.lang.String value) Configures the discriminator |
|
Mapping |
discriminator(java.util.Map args) Configures the discriminator |
|
protected PropertyConfig |
getOrInitializePropertyConfig(java.lang.String name) |
|
PropertyConfig |
getPropertyConfig(java.lang.String name) Obtains a PropertyConfig object for the given name |
|
java.util.Map<java.lang.String, PropertyConfig> |
getPropertyConfigs() |
|
java.lang.String |
getTableName() The table name |
|
java.lang.String |
getTypeName(java.lang.Class theClass) Return a type name of the known custom user types |
|
Mapping |
id(java.util.Map identityConfig) Define the identity config |
|
Mapping |
id(groovy.lang.Closure identityConfig) Define the identity config |
|
Mapping |
id(CompositeIdentity compositeIdentity) Define the identity config |
|
boolean |
isTablePerConcreteClass() |
|
java.lang.Object |
methodMissing(java.lang.String name, java.lang.Object args) |
|
Mapping |
property(java.lang.String name, groovy.lang.Closure propertyConfig) Configure a property |
|
Mapping |
property(java.lang.String name, java.util.Map propertyConfig) Configure a property |
|
PropertyConfig |
property(groovy.lang.Closure propertyConfig) Configure a new property |
|
PropertyConfig |
property(java.util.Map propertyConfig) Configure a new property |
|
java.lang.Object |
propertyMissing(java.lang.String name, java.lang.Object val) |
|
void |
setTableName(java.lang.String name) Set the table name |
|
void |
setTablePerConcreteClass(boolean tablePerConcreteClass) |
|
Mapping |
sort(java.lang.String name, java.lang.String direction) Configures sorting |
|
Mapping |
sort(java.util.Map nameAndDirections) Configures sorting |
|
Mapping |
table(java.lang.String name) Define the table name |
|
Mapping |
table(groovy.lang.Closure tableConfig) Define the table config |
|
Mapping |
table(java.util.Map tableConfig) Define the table config |
|
Mapping |
version(boolean isVersioned) |
|
Mapping |
version(java.util.Map versionConfig) |
|
Mapping |
version(java.lang.String versionColumn) |
|
Entity |
version(groovy.lang.Closure versionConfig) Configure the version |
Sets whether packaged domain classes should be auto-imported in HQL queries
The batch size to use for lazy loading
Caching config
The configuration for each property
DDL comment.
Value used to discriminate entities in table-per-hierarchy inheritance mapping
Whether to use dynamically created insert queries, at the cost of some performance
Whether to use dynamically created update queries, at the cost of some performance
The identity definition
Used to hold the names and directions of the default property to sort by
The table
Sets whether to use table-per-concrete-class or table-per-subclass mapping
Sets whether to use table-per-hierarchy or table-per-subclass mapping
Custom hibernate user types
Whether the class is versioned for optimistic locking
Define the cache config
cacheConfig
- The cache configDefine the cache config
cacheConfig
- The cache configDefine the cache config
cacheConfig
- The cache configDefine a new composite id @return
Configures an existing Mapping instance
config
- The configurationConfigures an existing Mapping instance
config
- The configurationConfigures a new Mapping instance
config
- The configurationConfigures the discriminator
discriminatorDef
- The discriminatorConfigures the discriminator
the
- discriminator valueConfigures the discriminator
discriminatorDef
- The discriminatorObtains a PropertyConfig object for the given name
The table name
Return a type name of the known custom user types
Define the identity config
identityConfig
- The id configDefine the identity config
identityConfig
- The id configDefine the identity config
identityConfig
- The id configConfigure a property
name
- The name of the propertypropertyConfig
- The property configConfigure a property
name
- The name of the propertypropertyConfig
- The property configConfigure a new property
name
- The name of the propertypropertyConfig
- The property configConfigure a new property
name
- The name of the propertypropertyConfig
- The property configSet the table name
Configures sorting
name
- The namedirection
- The directionConfigures sorting
name
- The namedirection
- The directionDefine the table name
name
- The table nameDefine the table config
tableConfig
- The table configDefine the table config
tableConfig
- The table config
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
Configures the name of the version column
{ version 'foo' }
isVersioned
- True if a version property should be configured
Configure the version
versionConfig
- The version configGroovy Documentation