Interface JpaTransactionManager
- All Superinterfaces:
TransactionManager
- All Known Implementing Classes:
JpaTransactionManagerImpl
TransactionManager
which defines JPA related methods.-
Nested Class Summary
Nested classes/interfaces inherited from interface google.registry.persistence.transaction.TransactionManager
TransactionManager.ThrowingRunnable
-
Method Summary
Modifier and TypeMethodDescription<T> void
assertDelete
(VKey<T> key) Deletes the entity by its id, throws exception if the entity is not deleted.<T> jakarta.persistence.TypedQuery
<T> criteriaQuery
(jakarta.persistence.criteria.CriteriaQuery<T> criteriaQuery) Creates a JPA SQL query for the given criteria query.Return thePersistenceModule.TransactionIsolationLevel
used in the current transaction.Return the defaultPersistenceModule.TransactionIsolationLevel
specified via the config file.jakarta.persistence.EntityManager
Returns theEntityManager
for the current request.jakarta.persistence.metamodel.Metamodel
Returns the JPAMetamodel
.jakarta.persistence.EntityManager
Returns a long-livedEntityManager
not bound to a particular transaction.jakarta.persistence.Query
Creates a JPA SQL query for the given query string.<T> jakarta.persistence.TypedQuery
<T> Creates a JPA SQL query for the given query string and result class.static jakarta.persistence.Query
setQueryFetchSize
(jakarta.persistence.Query query, int fetchSize) Sets the JDBC driver fetch size for thequery
.void
teardown()
Releases all resources and shuts down.Methods inherited from interface google.registry.persistence.transaction.TransactionManager
allocateId, assertInTransaction, createQueryComposer, delete, delete, delete, exists, exists, getTransactionTime, insert, insertAll, insertAll, inTransaction, loadAllOf, loadAllOfStream, loadByEntities, loadByEntitiesIfPresent, loadByEntity, loadByKey, loadByKeyIfPresent, loadByKeys, loadByKeysIfPresent, loadSingleton, put, putAll, putAll, reTransact, reTransact, transact, transact, transact, transact, transactNoRetry, transactNoRetry, update, updateAll, updateAll
-
Method Details
-
getStandaloneEntityManager
jakarta.persistence.EntityManager getStandaloneEntityManager()Returns a long-livedEntityManager
not bound to a particular transaction.Caller is responsible for closing the returned instance.
-
getMetaModel
jakarta.persistence.metamodel.Metamodel getMetaModel()Returns the JPAMetamodel
. -
getEntityManager
jakarta.persistence.EntityManager getEntityManager()Returns theEntityManager
for the current request.The returned instance is closed when the current transaction completes.
Note that in the current implementation the entity manager is obtained from a static
ThreadLocal
object that is set up by the outermostTransactionManager.transact(java.util.concurrent.Callable<T>)
call. Nested call sites have no control over which database instance to use. -
query
Creates a JPA SQL query for the given query string and result class.This is a convenience method for the longer
jpaTm().getEntityManager().createQuery(...)
. -
criteriaQuery
<T> jakarta.persistence.TypedQuery<T> criteriaQuery(jakarta.persistence.criteria.CriteriaQuery<T> criteriaQuery) Creates a JPA SQL query for the given criteria query. -
query
Creates a JPA SQL query for the given query string.This is a convenience method for the longer
jpaTm().getEntityManager().createQuery(...)
.Note that while this method can legally be used for queries that return results, it should not be, as it does not correctly detach entities as must be done for nomulus model objects.
-
assertDelete
Deletes the entity by its id, throws exception if the entity is not deleted. -
teardown
void teardown()Releases all resources and shuts down.The errorprone check forbids injection of
Closeable
resources. -
setQueryFetchSize
static jakarta.persistence.Query setQueryFetchSize(jakarta.persistence.Query query, int fetchSize) Sets the JDBC driver fetch size for thequery
. This overrides the default configuration. -
getDefaultTransactionIsolationLevel
PersistenceModule.TransactionIsolationLevel getDefaultTransactionIsolationLevel()Return the defaultPersistenceModule.TransactionIsolationLevel
specified via the config file. -
getCurrentTransactionIsolationLevel
PersistenceModule.TransactionIsolationLevel getCurrentTransactionIsolationLevel()Return thePersistenceModule.TransactionIsolationLevel
used in the current transaction.
-