interface GormStaticOperations<D>
Interface for the default static methods in GORM
Type Params | Return Type | Name and description |
---|---|---|
|
abstract java.lang.Integer |
count() Counts the number of persisted entities |
|
abstract D |
create() Creates an instance of this class |
|
abstract BuildableCriteria |
createCriteria() Creates a criteria builder instance |
|
abstract void |
deleteAll(java.lang.Object[] objectsToDelete) Deletes a list of objects in one go |
|
abstract void |
deleteAll(java.lang.Iterable objectToDelete) Deletes a list of objects in one go |
|
abstract GormAllOperations<D> |
eachTenant(groovy.lang.Closure callable) Execute the closure for each tenant |
|
abstract java.util.List |
executeQuery(java.lang.CharSequence query) Executes a query for the given String |
|
abstract java.util.List |
executeQuery(java.lang.CharSequence query, java.util.Map args) Executes a query for the given String |
|
abstract java.util.List |
executeQuery(java.lang.CharSequence query, java.util.Map params, java.util.Map args) Executes a query for the given String |
|
abstract java.util.List |
executeQuery(java.lang.CharSequence query, java.util.Collection params) Executes a query for the given String |
|
abstract java.util.List |
executeQuery(java.lang.CharSequence query, java.lang.Object[] params) Executes a query for the given String |
|
abstract java.util.List |
executeQuery(java.lang.CharSequence query, java.util.Collection params, java.util.Map args) Executes a query for the given String |
|
abstract java.lang.Integer |
executeUpdate(java.lang.CharSequence query) Executes an update for the given String |
|
abstract java.lang.Integer |
executeUpdate(java.lang.CharSequence query, java.util.Map args) Executes an update for the given String |
|
abstract java.lang.Integer |
executeUpdate(java.lang.CharSequence query, java.util.Map params, java.util.Map args) Executes an update for the given String |
|
abstract java.lang.Integer |
executeUpdate(java.lang.CharSequence query, java.util.Collection params) Executes an update for the given String |
|
abstract java.lang.Integer |
executeUpdate(java.lang.CharSequence query, java.lang.Object[] params) Executes an update for the given String |
|
abstract java.lang.Integer |
executeUpdate(java.lang.CharSequence query, java.util.Collection params, java.util.Map args) Executes an update for the given String |
|
abstract boolean |
exists(java.io.Serializable id) Checks whether an entity exists |
|
abstract D |
find(groovy.lang.Closure callable) Uses detached criteria to build a query and then execute it returning a list |
|
abstract D |
find(D example) Finds an object by example |
|
abstract D |
find(D example, java.util.Map args) Finds an object by example using the given arguments for pagination |
|
abstract D |
find(java.lang.CharSequence query) Finds an object for the given string-based query |
|
abstract D |
find(java.lang.CharSequence query, java.util.Map params) Finds an object for the given string-based query and named parameters |
|
abstract D |
find(java.lang.CharSequence query, java.util.Map params, java.util.Map args) Finds an object for the given string-based query, named parameters and arguments |
|
abstract D |
find(java.lang.CharSequence query, java.util.Collection params) Finds an object for the given string-based query and positional parameters |
|
abstract D |
find(java.lang.CharSequence query, java.lang.Object[] params) Finds an object for the given string-based query and positional parameters |
|
abstract D |
find(java.lang.CharSequence query, java.util.Collection params, java.util.Map args) Finds an object for the given string-based query, positional parameters and arguments |
|
abstract java.util.List<D> |
findAll(groovy.lang.Closure callable) Uses detached criteria to build a query and then execute it returning a list |
|
abstract java.util.List<D> |
findAll(java.util.Map args, groovy.lang.Closure callable) Uses detached criteria to build a query and then execute it returning a list |
|
abstract java.util.List<D> |
findAll(java.util.Map params) The same as list() |
|
abstract java.util.List<D> |
findAll() The same as list() |
|
abstract java.util.List<D> |
findAll(D example) Finds an object by example |
|
abstract java.util.List<D> |
findAll(D example, java.util.Map args) Finds an object by example using the given arguments for pagination |
|
abstract java.util.List<D> |
findAll(java.lang.CharSequence query) Finds all objects for the given string-based query |
|
abstract java.util.List<D> |
findAll(java.lang.CharSequence query, java.util.Map params) Finds all objects for the given string-based query and named parameters |
|
abstract java.util.List<D> |
findAll(java.lang.CharSequence query, java.util.Map params, java.util.Map args) Finds all objects for the given string-based query, named parameters and arguments |
|
abstract java.util.List<D> |
findAll(java.lang.CharSequence query, java.util.Collection params) Finds all objects for the given string-based query and positional parameters |
|
abstract java.util.List<D> |
findAll(java.lang.CharSequence query, java.lang.Object[] params) Finds all objects for the given string-based query and positional parameters |
|
abstract java.util.List<D> |
findAll(java.lang.CharSequence query, java.util.Collection params, java.util.Map args) Finds all objects for the given string-based query, positional parameters and arguments |
|
abstract java.util.List<D> |
findAllWhere(java.util.Map queryMap) Finds all results matching all of the given conditions. |
|
abstract java.util.List<D> |
findAllWhere(java.util.Map queryMap, java.util.Map args) Finds all results matching all of the given conditions. |
|
abstract D |
findOrCreateWhere(java.util.Map queryMap) Finds a single result matching all of the given conditions. |
|
abstract D |
findOrSaveWhere(java.util.Map queryMap) Finds a single result matching all of the given conditions. |
|
abstract D |
findWhere(java.util.Map queryMap) Finds a single result matching all of the given conditions. |
|
abstract D |
findWhere(java.util.Map queryMap, java.util.Map args) Finds a single result matching all of the given conditions. |
|
abstract D |
first() Finds the first object using the natural sort order |
|
abstract D |
first(java.lang.String propertyName) Finds the first object sorted by propertyName |
|
abstract D |
first(java.util.Map queryParams) Finds the first object. |
|
abstract D |
get(java.io.Serializable id) Retrieves an object from the datastore. eg. |
|
abstract java.util.List<D> |
getAll(java.lang.Iterable<java.io.Serializable> ids) Retrieve all the objects for the given identifiers |
|
abstract java.util.List<D> |
getAll(java.io.Serializable[] ids) Retrieve all the objects for the given identifiers |
|
abstract java.util.List<D> |
getAll()
|
|
abstract java.lang.Integer |
getCount() Same as count() but allows property-style syntax (Foo.count) |
|
abstract java.util.List<FinderMethod> |
getGormDynamicFinders()
|
|
abstract PersistentEntity |
getGormPersistentEntity()
|
|
abstract D |
last() Finds the last object using the natural sort order |
|
abstract D |
last(java.lang.String propertyName) Finds the last object sorted by propertyName |
|
abstract D |
last(java.util.Map queryParams) Finds the last object. |
|
abstract java.util.List<D> |
list(java.util.Map params) Lists objects in the datastore. eg. |
|
abstract java.util.List<D> |
list() List all entities |
|
abstract D |
load(java.io.Serializable id) Retrieves an object from the datastore as a proxy. eg. |
|
abstract D |
lock(java.io.Serializable id) Locks an instance for an update |
|
abstract D |
merge(D d) Merges an instance with the current session |
|
abstract java.lang.Object |
methodMissing(java.lang.String methodName, java.lang.Object arg) Handles static method missing for dynamic finders |
|
abstract java.lang.Object |
propertyMissing(java.lang.String property) Handles property missing, does nothing by default, sub traits to override |
|
abstract void |
propertyMissing(java.lang.String property, java.lang.Object value) Handles property missing, does nothing by default, sub traits to override |
|
abstract D |
proxy(java.io.Serializable id) Retrieves an object from the datastore as a proxy. eg. |
|
abstract D |
read(java.io.Serializable id) Retrieves an object from the datastore. eg. |
|
abstract java.util.List<java.io.Serializable> |
saveAll(java.lang.Object[] objectsToSave) Saves a list of objects in one go |
|
abstract java.util.List<java.io.Serializable> |
saveAll(java.lang.Iterable<?> objectsToSave) Saves a list of objects in one go |
|
abstract DetachedCriteria<D> |
where(groovy.lang.Closure callable)
|
|
abstract DetachedCriteria<D> |
whereAny(groovy.lang.Closure callable)
|
|
abstract DetachedCriteria<D> |
whereLazy(groovy.lang.Closure callable)
|
<T> |
abstract T |
withCriteria(groovy.lang.Closure<T> callable) Creates a criteria builder instance |
<T> |
abstract T |
withCriteria(java.util.Map builderArgs, groovy.lang.Closure callable) Creates a criteria builder instance |
<T> |
abstract T |
withDatastoreSession(groovy.lang.Closure<T> callable) Same as withSession, but present for the case where withSession is overridden to use the Hibernate session |
<T> |
abstract T |
withNewSession(groovy.lang.Closure<T> callable) Creates and binds a new session for the scope of the given closure |
<T> |
abstract T |
withNewTransaction(groovy.lang.Closure<T> callable) Executes the closure within the context of a new transaction |
<T> |
abstract T |
withNewTransaction(java.util.Map transactionProperties, groovy.lang.Closure<T> callable) Executes the closure within the context of a new transaction which is configured with the properties contained in transactionProperties. |
<T> |
abstract T |
withSession(groovy.lang.Closure<T> callable) Execute a closure whose first argument is a reference to the current session. |
<T> |
abstract T |
withStatelessSession(groovy.lang.Closure<T> callable) Creates and binds a new session for the scope of the given closure |
<T> |
abstract T |
withTenant(java.io.Serializable tenantId, groovy.lang.Closure<T> callable) Execute the closure with the given tenantId |
|
abstract GormAllOperations<D> |
withTenant(java.io.Serializable tenantId) Return the GormAllOperations for the given tenant id |
<T> |
abstract T |
withTransaction(groovy.lang.Closure<T> callable) Executes the closure within the context of a transaction, creating one if none is present or joining an existing transaction if one is already present. |
<T> |
abstract T |
withTransaction(java.util.Map transactionProperties, groovy.lang.Closure<T> callable) Executes the closure within the context of a transaction which is configured with the properties contained in transactionProperties. |
<T> |
abstract T |
withTransaction(org.springframework.transaction.TransactionDefinition definition, groovy.lang.Closure<T> callable) Executes the closure within the context of a transaction for the given org.springframework.transaction.TransactionDefinition |
Counts the number of persisted entities
Creates an instance of this class
Creates a criteria builder instance
Deletes a list of objects in one go
objectsToDelete
- The objects to deleteDeletes a list of objects in one go
objectsToDelete
- Collection of objects to deleteExecute the closure for each tenant
callable
- The closureExecutes a query for the given String
query
- The query represented by the given stringExecutes a query for the given String
query
- The query represented by the given stringargs
- The arguments to the queryExecutes a query for the given String
query
- The query represented by the given stringparams
- The named parameters to the queryargs
- The arguments to the queryExecutes a query for the given String
query
- The query represented by the given stringparams
- The positional parameters to the queryExecutes a query for the given String
query
- The query represented by the given stringparams
- The positional parameters to the queryExecutes a query for the given String
query
- The query represented by the given stringparams
- The positional parameters to the queryargs
- The arguments to the queryExecutes an update for the given String
query
- The query represented by the given stringExecutes an update for the given String
query
- The query represented by the given stringparams
- The parameters to the queryExecutes an update for the given String
query
- The query represented by the given stringparams
- The parameters to the queryargs
- The arguments to the queryExecutes an update for the given String
query
- The query represented by the given stringparams
- The positional parameters to the queryExecutes an update for the given String
query
- The query represented by the given stringparams
- The positional parameters to the queryExecutes an update for the given String
query
- The query represented by the given stringparams
- The positional parameters to the queryargs
- The arguments to the queryChecks whether an entity exists
Uses detached criteria to build a query and then execute it returning a list
callable
- The callableFinds an object by example
example
- The exampleFinds an object by example using the given arguments for pagination
example
- The exampleargs
- The argumentsFinds an object for the given string-based query
query
- The queryFinds an object for the given string-based query and named parameters
query
- The queryparams
- The parametersFinds an object for the given string-based query, named parameters and arguments
query
- The queryparams
- The parametersFinds an object for the given string-based query and positional parameters
query
- The queryparams
- The parametersFinds an object for the given string-based query and positional parameters
query
- The queryparams
- The parametersFinds an object for the given string-based query, positional parameters and arguments
query
- The queryparams
- The parametersUses detached criteria to build a query and then execute it returning a list
callable
- The callableUses detached criteria to build a query and then execute it returning a list
args
- pagination parameterscallable
- The callableThe same as list()
The same as list()
Finds an object by example
example
- The exampleFinds an object by example using the given arguments for pagination
example
- The exampleargs
- The argumentsFinds all objects for the given string-based query
query
- The queryFinds all objects for the given string-based query and named parameters
query
- The queryparams
- The parametersFinds all objects for the given string-based query, named parameters and arguments
query
- The queryparams
- The parametersFinds all objects for the given string-based query and positional parameters
query
- The queryparams
- The parametersFinds all objects for the given string-based query and positional parameters
query
- The queryparams
- The parametersFinds all objects for the given string-based query, positional parameters and arguments
query
- The queryparams
- The parametersFinds all results matching all of the given conditions. Eg. Book.findAllWhere(author:"Stephen King", title:"The Stand")
queryMap
- The map of conditionsFinds all results matching all of the given conditions. Eg. Book.findAllWhere(author:"Stephen King", title:"The Stand")
queryMap
- The map of conditionsargs
- The Query argumentsFinds a single result matching all of the given conditions. Eg. Book.findWhere(author:"Stephen King", title:"The Stand"). If a matching persistent entity is not found a new entity is created and returned.
queryMap
- The map of conditionsFinds a single result matching all of the given conditions. Eg. Book.findWhere(author:"Stephen King", title:"The Stand"). If a matching persistent entity is not found a new entity is created, saved and returned.
queryMap
- The map of conditionsFinds a single result matching all of the given conditions. Eg. Book.findWhere(author:"Stephen King", title:"The Stand")
queryMap
- The map of conditionsFinds a single result matching all of the given conditions. Eg. Book.findWhere(author:"Stephen King", title:"The Stand")
queryMap
- The map of conditionsargs
- The Query argumentsFinds the first object using the natural sort order
Finds the first object sorted by propertyName
propertyName
- the name of the property to sort byFinds the first object. If queryParams includes 'sort', that will dictate the sort order, otherwise natural sort order will be used. queryParams may include any of the same parameters that might be passed to the list(Map) method. This method will ignore 'order' and 'max' as those are always 'asc' and 1, respectively.
Retrieves an object from the datastore. eg. Book.get(1)
Retrieve all the objects for the given identifiers
ids
- The identifiers to operate againstRetrieve all the objects for the given identifiers
ids
- The identifiers to operate against
Same as count() but allows property-style syntax (Foo.count)
Finds the last object using the natural sort order
Finds the last object sorted by propertyName
propertyName
- the name of the property to sort byFinds the last object. If queryParams includes 'sort', that will dictate the sort order, otherwise natural sort order will be used. queryParams may include any of the same parameters that might be passed to the list(Map) method. This method will ignore 'order' and 'max' as those are always 'asc' and 1, respectively.
Lists objects in the datastore. eg. Book.list(max:10)
params
- Any parameters such as offset, max etc.List all entities
Retrieves an object from the datastore as a proxy. eg. Book.load(1)
Locks an instance for an update
id
- The identifierMerges an instance with the current session
d
- The object to mergeHandles static method missing for dynamic finders
methodName
- The name of the methodarg
- the argument to the methodHandles property missing, does nothing by default, sub traits to override
property
- The propertyHandles property missing, does nothing by default, sub traits to override
property
- The propertyvalue
- The value of the propertyRetrieves an object from the datastore as a proxy. eg. Book.proxy(1)
Retrieves an object from the datastore. eg. Book.read(1) Since the datastore abstraction doesn't support dirty checking yet this just delegates to get(Serializable)
Saves a list of objects in one go
objectsToSave
- The objects to saveSaves a list of objects in one go
objectToSave
- Collection of objects to save
callable
- Callable closure containing detached criteria definition
callable
- Callable closure containing detached criteria definition
callable
- Callable closure containing detached criteria definitionCreates a criteria builder instance
Creates a criteria builder instance
Same as withSession, but present for the case where withSession is overridden to use the Hibernate session
callable
- the closureCreates and binds a new session for the scope of the given closure
Executes the closure within the context of a new transaction
callable
- The closure to callExecutes the closure within the context of a new transaction which is configured with the properties contained in transactionProperties. transactionProperties may contain any properties supported by org.springframework.transaction.support.DefaultTransactionDefinition. Note that if transactionProperties includes entries for propagationBehavior or propagationName, those values will be ignored. This method always sets the propagation level to TransactionDefinition.REQUIRES_NEW.
SomeEntity.withNewTransaction([isolationLevel: TransactionDefinition.ISOLATION_REPEATABLE_READ]) { // ... }
transactionProperties
- properties to configure the transaction propertiescallable
- The closure to callExecute a closure whose first argument is a reference to the current session.
callable
- the closureCreates and binds a new session for the scope of the given closure
Execute the closure with the given tenantId
tenantId
- The tenant idcallable
- The closureReturn the GormAllOperations for the given tenant id
tenantId
- The tenant idExecutes the closure within the context of a transaction, creating one if none is present or joining an existing transaction if one is already present.
callable
- The closure to callExecutes the closure within the context of a transaction which is configured with the properties contained in transactionProperties. transactionProperties may contain any properties supported by org.springframework.transaction.support.DefaultTransactionDefinition.
SomeEntity.withTransaction([propagationBehavior: TransactionDefinition.PROPAGATION_REQUIRES_NEW, isolationLevel: TransactionDefinition.ISOLATION_REPEATABLE_READ]) { // ... }
transactionProperties
- properties to configure the transaction propertiescallable
- The closure to callExecutes the closure within the context of a transaction for the given org.springframework.transaction.TransactionDefinition
callable
- The closure to call