interface GormInstanceOperations<D>
Instance methods of the GORM API.
D - the entity/domain class| Type Params | Return Type | Name and description |
|---|---|---|
|
abstract D |
attach(D instance)Attaches an instance to an existing session. |
|
abstract void |
delete(D instance)Deletes an instance from the datastore |
|
abstract void |
delete(D instance, java.util.Map params)Deletes an instance from the datastore |
|
abstract void |
discard(D instance)Discards any pending changes. |
|
abstract java.io.Serializable |
ident(D instance)Returns the objects identifier |
|
abstract D |
insert(D instance)Forces an insert of an object to the datastore |
|
abstract D |
insert(D instance, java.util.Map params)Forces an insert of an object to the datastore |
|
abstract boolean |
instanceOf(D instance, java.lang.Class cls)Proxy aware instanceOf implementation. |
|
abstract boolean |
isAttached(D instance)No concept of session-based model so defaults to true |
|
abstract D |
lock(D instance)Upgrades an existing persistence instance to a write lock |
|
abstract D |
merge(D instance)Saves an object the datastore |
|
abstract D |
merge(D instance, java.util.Map params)Saves an object the datastore |
<T> |
abstract T |
mutex(D instance, groovy.lang.Closure<T> callable)Locks the given instance for updates for the scope of the passed closure. |
|
abstract java.lang.Object |
propertyMissing(D instance, java.lang.String name)Allow access to datasource by name |
|
abstract D |
refresh(D instance)Refreshes the state of the current instance |
|
D |
refresh(D instance, java.util.Map args)Refreshes the state of the given instance, with options. |
|
abstract D |
save(D instance)Saves an object the datastore |
|
abstract D |
save(D instance, boolean validate)Save method that takes a boolean which indicates whether to perform validation or not |
|
abstract D |
save(D instance, java.util.Map params)Saves an object with the given parameters |
|
boolean |
supportsLockedRefresh()Whether refresh(java.lang.Object, java.util.Map) reloads an instance under a requested lock. |
Attaches an instance to an existing session. Requries a session-based model @return
Deletes an instance from the datastore
Deletes an instance from the datastore
Discards any pending changes. Requires a session-based model.
Returns the objects identifier
Forces an insert of an object to the datastore
Forces an insert of an object to the datastore
Proxy aware instanceOf implementation.
No concept of session-based model so defaults to true
Upgrades an existing persistence instance to a write lock
Saves an object the datastore
Saves an object the datastore
Locks the given instance for updates for the scope of the passed closure.
The lock is exclusive. A datastore that reports supportsLockedRefresh() reloads the instance's state and version under the lock, so that a competing writer is waited for and the closure runs on the committed state rather than failing on the version loaded earlier. Reloading discards unflushed changes to the instance, and requires an active transaction and an attached instance.
instance - The instancecallable - The closureAllow access to datasource by name
instance - The instancename - The property nameRefreshes the state of the current instance
Refreshes the state of the given instance, with options.
Supported arguments:
lock - true reloads the instance's database state and version under a pessimistic
write lock; a jakarta.persistence.LockModeType reloads them under that lock mode instead. Either
form acquires the lock before it reloads, discards unflushed changes, requires an attached
instance and an active transaction, and holds the lock until that transaction commits or rolls back.
false and jakarta.persistence.LockModeType#NONE request no lock.Without a requested lock this behaves like refresh(java.lang.Object). The default implementation rejects a requested lock; datastores that support it override this method.
jakarta.persistence.TransactionRequiredException for Hibernatelock argument is neither a boolean nor a lock modeinstance - The instanceargs - The named argumentsSaves an object the datastore
Save method that takes a boolean which indicates whether to perform validation or not
validate - Whether to perform validationSaves an object with the given parameters
instance - The instanceparams - The parametersWhether refresh(java.lang.Object, java.util.Map) reloads an instance under a requested lock.
A datastore that overrides refresh(D, Map) to honour the lock argument must report
true here; one that overrides it for unrelated arguments must not, so that callers are told the
lock is unavailable instead of receiving an instance that was never locked.
false for the default implementation, which rejects a requested lock