@groovy.transform.CompileStatic class GormInstanceApi<D> extends AbstractGormApi<D> implements GormInstanceOperations<D>
Instance methods of the GORM API.
D
- the entity/domain classType | Name and description |
---|---|
boolean |
failOnError |
boolean |
markDirty |
java.lang.Class<? extends java.lang.Exception> |
validationException |
Constructor and description |
---|
GormInstanceApi(java.lang.Class<D> persistentClass, Datastore datastore) |
Type Params | Return Type | Name and description |
---|---|---|
|
D |
attach(D instance) Attaches an instance to an existing session. |
|
void |
delete(D instance) Deletes an instance from the datastore |
|
void |
delete(D instance, java.util.Map params) Deletes an instance from the datastore |
|
void |
discard(D instance) Discards any pending changes. |
|
protected D |
doSave(D instance, java.util.Map params, Session session, boolean isInsert) |
|
java.util.List |
getDirtyPropertyNames(D instance) Obtains a list of property names that are dirty |
|
java.lang.Object |
getPersistentValue(D instance, java.lang.String fieldName) Gets the original persisted value of a field. |
|
java.io.Serializable |
ident(D instance) Returns the objects identifier |
|
D |
insert(D instance) Forces an insert of an object to the datastore |
|
D |
insert(D instance, java.util.Map params) Forces an insert of an object to the datastore |
|
boolean |
instanceOf(D o, java.lang.Class cls) Proxy aware instanceOf implementation. |
|
boolean |
isAttached(D instance) No concept of session-based model so defaults to true |
|
boolean |
isDirty(D instance, java.lang.String fieldName) Checks whether a field is dirty |
|
boolean |
isDirty(D instance) Checks whether an entity is dirty |
|
D |
lock(D instance) Upgrades an existing persistence instance to a write lock |
|
D |
merge(D instance) Saves an object the datastore |
|
D |
merge(D instance, java.util.Map params) Saves an object the datastore |
<T> |
T |
mutex(D instance, groovy.lang.Closure<T> callable) Locks the instance for updates for the scope of the passed closure |
|
java.lang.Object |
propertyMissing(D instance, java.lang.String name) |
|
D |
refresh(D instance) Refreshes the state of the current instance |
|
D |
save(D instance) Saves an object the datastore |
|
D |
save(D instance, boolean validate) Save method that takes a boolean which indicates whether to perform validation or not |
|
D |
save(D instance, java.util.Map params) Saves an object with the given parameters |
Attaches an instance to an existing session. Requries a session-based model @return
instance
- The instanceDeletes an instance from the datastore
instance
- The instance to deleteDeletes an instance from the datastore
instance
- The instance to deleteDiscards any pending changes. Requires a session-based model.
Obtains a list of property names that are dirty
instance
- The instanceGets the original persisted value of a field.
fieldName
- The field nameReturns the objects identifier
Forces an insert of an object to the datastore
instance
- The instanceForces an insert of an object to the datastore
instance
- The instanceProxy aware instanceOf implementation.
No concept of session-based model so defaults to true
Checks whether a field is dirty
instance
- The instancefieldName
- The name of the fieldChecks whether an entity is dirty
instance
- The instanceUpgrades an existing persistence instance to a write lock
Saves an object the datastore
instance
- The instanceSaves an object the datastore
instance
- The instanceLocks the instance for updates for the scope of the passed closure
callable
- The closureRefreshes the state of the current instance
instance
- The instanceSaves an object the datastore
instance
- The instanceSave method that takes a boolean which indicates whether to perform validation or not
instance
- The instancevalidate
- Whether to perform validationSaves an object with the given parameters
instance
- The instanceparams
- The parametersGroovy Documentation