Static methods of the GORM API.
- the entity/domain classFields inherited from class | Fields |
---|---|
class AbstractGormApi |
persistentClass, persistentEntity |
class AbstractDatastoreApi |
datastore |
Constructor and description |
---|
GormStaticApi
(java.lang.Class<D> persistentClass, Datastore datastore, java.util.List<FinderMethod> finders) |
GormStaticApi
(java.lang.Class<D> persistentClass, Datastore datastore, java.util.List<FinderMethod> finders, org.springframework.transaction.PlatformTransactionManager transactionManager) |
Type | Name and description |
---|---|
java.lang.Integer |
count() Counts the number of persisted entities |
D |
create() Creates an instance of this class |
Criteria |
createCriteria() Creates a criteria builder instance |
void |
deleteAll(D... objectsToDelete) Deletes a list of objects in one go |
java.util.List<D> |
executeQuery(java.lang.String query) |
java.util.List<D> |
executeQuery(java.lang.String query, java.util.Map args) |
java.util.List<D> |
executeQuery(java.lang.String query, java.util.Map params, java.util.Map args) |
java.util.List<D> |
executeQuery(java.lang.String query, java.util.Collection params) |
java.util.List<D> |
executeQuery(java.lang.String query, java.util.Collection params, java.util.Map args) |
java.lang.Integer |
executeUpdate(java.lang.String query) |
java.lang.Integer |
executeUpdate(java.lang.String query, java.util.Map args) |
java.lang.Integer |
executeUpdate(java.lang.String query, java.util.Map params, java.util.Map args) |
java.lang.Integer |
executeUpdate(java.lang.String query, java.util.Collection params) |
java.lang.Integer |
executeUpdate(java.lang.String query, java.util.Collection params, java.util.Map args) |
boolean |
exists(java.io.Serializable id) Checks whether an entity exists |
D |
find(groovy.lang.Closure callable) Uses detached criteria to build a query and then execute it returning a list |
D |
find(D example) Finds an object by example |
D |
find(D example, java.util.Map args) Finds an object by example using the given arguments for pagination |
D |
find(java.lang.String query) |
D |
find(java.lang.String query, java.util.Map args) |
D |
find(java.lang.String query, java.util.Map params, java.util.Map args) |
D |
find(java.lang.String query, java.util.Collection params) |
D |
find(java.lang.String query, java.util.Collection params, java.util.Map args) |
java.util.List<D> |
findAll(groovy.lang.Closure callable) Uses detached criteria to build a query and then execute it returning a list |
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 |
java.util.List<D> |
findAll() The same as list() |
java.util.List<D> |
findAll(D example) Finds an object by example |
java.util.List<D> |
findAll(D example, java.util.Map args) Finds an object by example using the given arguments for pagination |
java.util.List<D> |
findAll(java.lang.String query) |
java.util.List<D> |
findAll(java.lang.String query, java.util.Map args) |
java.util.List<D> |
findAll(java.lang.String query, java.util.Map params, java.util.Map args) |
java.util.List<D> |
findAll(java.lang.String query, java.util.Collection params) |
java.util.List<D> |
findAll(java.lang.String query, java.util.Collection params, java.util.Map args) |
java.util.List<D> |
findAllWhere(java.util.Map queryMap) Finds all results matching all of the given conditions. |
java.util.List<D> |
findAllWhere(java.util.Map queryMap, java.util.Map args) Finds all results matching all of the given conditions. |
D |
findOrCreateWhere(java.util.Map queryMap) Finds a single result matching all of the given conditions. |
D |
findOrSaveWhere(java.util.Map queryMap) Finds a single result matching all of the given conditions. |
D |
findWhere(java.util.Map queryMap) Finds a single result matching all of the given conditions. |
D |
findWhere(java.util.Map queryMap, java.util.Map args) Finds a single result matching all of the given conditions. |
D |
get(java.io.Serializable id) Retrieves and object from the datastore. eg. |
java.util.List<D> |
getAll(java.io.Serializable... ids) Retrieve all the objects for the given identifiers |
java.util.List<D> |
getAll() @return Synonym for list() |
java.lang.Integer |
getCount() Same as count() but allows property-style syntax (Foo.count) |
java.util.List<FinderMethod> |
getGormDynamicFinders() @return The FinderMethods for this class |
PersistentEntity |
getGormPersistentEntity() @return The PersistentEntity for this class |
java.util.Map<D, org.springframework.validation.Errors> |
getValidationErrorsMap() Get the thread-local map used to store Errors when validating. |
java.util.Map<D, java.lang.Boolean> |
getValidationSkipMap() Get the thread-local map used to store whether to skip validation. |
java.util.List<D> |
list(java.util.Map params) Lists objects in the datastore. eg. |
java.util.List<D> |
list() List all entities |
D |
load(java.io.Serializable id) Retrieves and object from the datastore as a proxy. eg. |
D |
lock(java.io.Serializable id) Locks an instance for an update |
D |
merge(D d) Merges an instance with the current session |
java.lang.Object |
methodMissing(java.lang.String methodName, java.lang.Object args) Method missing handler that deals with the invocation of dynamic finders |
D |
proxy(java.io.Serializable id) Retrieves and object from the datastore as a proxy. eg. |
D |
read(java.io.Serializable id) Retrieves and object from the datastore. eg. |
java.util.List<java.io.Serializable> |
saveAll(D... objectsToSave) Saves a list of objects in one go |
void |
setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager) Sets the org.springframework.transaction.PlatformTransactionManager to use |
void |
unsupported(java.lang.Object method) |
DetachedCriteria<D> |
where(groovy.lang.Closure callable) @param callable Callable closure containing detached criteria definition |
DetachedCriteria<D> |
whereAny(groovy.lang.Closure callable) @param callable Callable closure containing detached criteria definition |
java.lang.Object |
withCriteria(groovy.lang.Closure callable) Creates a criteria builder instance |
java.lang.Object |
withCriteria(java.util.Map builderArgs, groovy.lang.Closure callable) Creates a criteria builder instance |
java.lang.Object |
withDatastoreSession(groovy.lang.Closure callable) Same as withSession, but present for the case where withSession is overridden to use the Hibernate session |
java.lang.Object |
withNewSession(groovy.lang.Closure callable) Creates and binds a new session for the scope of the given closure |
java.lang.Object |
withNewTransaction(groovy.lang.Closure callable) Executes the closure within the context of a new transaction |
java.lang.Object |
withSession(groovy.lang.Closure callable) Execute a closure whose first argument is a reference to the current session. |
java.lang.Object |
withTransaction(groovy.lang.Closure 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. |
java.lang.Object |
withTransaction(org.springframework.transaction.TransactionDefinition definition, groovy.lang.Closure callable) Executes the closure within the context of a transaction for the given org.springframework.transaction.TransactionDefinition |
Methods inherited from class | Name |
---|---|
class AbstractGormApi |
getExtendedMethods, getMethods |
class AbstractDatastoreApi |
execute, execute |
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), 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() |
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 deleteChecks 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 argumentsUses 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()
Finds an object by example
example
- The exampleFinds an object by example using the given arguments for pagination
example
- The exampleargs
- The argumentsFinds 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 argumentsRetrieves and object from the datastore. eg. Book.get(1)
Retrieve all the objects for the given identifiers
ids
- The identifiers to operate against
Same as count() but allows property-style syntax (Foo.count)
Get the thread-local map used to store Errors when validating.
Get the thread-local map used to store whether to skip validation.
Lists objects in the datastore. eg. Book.list(max:10)
params
- Any parameters such as offset, max etc.List all entities
Retrieves and 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 mergeMethod missing handler that deals with the invocation of dynamic finders
methodName
- The method nameargs
- The argumentsRetrieves and object from the datastore as a proxy. eg. Book.proxy(1)
Retrieves and 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 saveSets the org.springframework.transaction.PlatformTransactionManager to use
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 callExecute a closure whose first argument is a reference to the current session.
callable
- the closureExecutes 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 for the given org.springframework.transaction.TransactionDefinition
callable
- The closure to call