JpaDialect interface.
Used as default dialect by JpaTransactionManager.
Simply begins a standard JPA transaction in beginTransaction and
performs standard exception translation through EntityManagerFactoryUtils.
JpaTransactionManager#setJpaDialect
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Object | beginTransaction(EntityManager
the EntityManager to begin a JPA transaction on entityManager, TransactionDefinition the Spring transaction definition that defines semantics definition)Implements org. Transaction.begin
method.
|
| public void | cleanupTransaction(Object
arbitrary object that holds transaction data, if any
(as returned by beginTransaction or prepareTransaction) transactionData)Implements org. beginTransaction
implementation does not require any cleanup.
|
| public ConnectionHandle | getJdbcConnection(EntityManager
the current JPA EntityManager entityManager, boolean whether the Connection is only needed for read-only purposes readOnly)Implements org. null,
indicating that no JDBC Connection can be provided.
|
| public Object | prepareTransaction(EntityManager
the EntityManager to begin a JPA transaction on entityManager, boolean whether the transaction is supposed to be read-only readOnly, String the name of the transaction (if any) name)Implements org. |
| public void | releaseJdbcConnection(ConnectionHandle
the JDBC Connection handle to release conHandle, EntityManager the current JPA EntityManager em)Implements org. |
| public DataAccessException | translateExceptionIfPossible(RuntimeException
a RuntimeException to translate ex)Implements org. |
| DefaultJpaDialect | back to summary |
|---|---|
| public DefaultJpaDialect() | |
| beginTransaction | back to summary |
|---|---|
| public Object beginTransaction(EntityManager entityManager, TransactionDefinition definition) throws PersistenceException, SQLException, TransactionException Implements org. This implementation invokes the standard JPA This implementation does not return any transaction data Object, since there
is no state to be kept for a standard JPA transaction. Hence, subclasses do not
have to care about the return value (
| |
| cleanupTransaction | back to summary |
|---|---|
| public void cleanupTransaction(Object transactionData) Implements org. This implementation does nothing, since the default
| |
| getJdbcConnection | back to summary |
|---|---|
| public ConnectionHandle getJdbcConnection(EntityManager entityManager, boolean readOnly) throws PersistenceException, SQLException Implements org. This implementation always returns
| |
| prepareTransaction | back to summary |
|---|---|
| public Object prepareTransaction(EntityManager entityManager, boolean readOnly, String name) throws PersistenceException Implements org. Doc from org. Prepare a JPA transaction, applying the specified semantics. Called by EntityManagerFactoryUtils when enlisting an EntityManager in a JTA transaction or a locally joined transaction (e.g. after upgrading an unsynchronized EntityManager to a synchronized one). An implementation can apply the read-only flag as flush mode. In that case,
a transaction data object can be returned that holds the previous flush mode
(and possibly other data), to be reset in Implementations can also use the Spring transaction name to optimize for specific data access use cases (effectively using the current transaction name as use case identifier).
| |
| releaseJdbcConnection | back to summary |
|---|---|
| public void releaseJdbcConnection(ConnectionHandle conHandle, EntityManager em) throws PersistenceException, SQLException Implements org. This implementation does nothing, assuming that the Connection will implicitly be closed with the EntityManager. If the JPA implementation returns a Connection handle that it expects
the application to close after use, the dialect implementation needs to invoke
| |
| translateExceptionIfPossible | back to summary |
|---|---|
| public DataAccessException translateExceptionIfPossible(RuntimeException ex) Implements org. This implementation delegates to EntityManagerFactoryUtils.
| |