| |
|
| java.lang.Object org.springframework.transaction.support.AbstractPlatformTransactionManager org.springframework.orm.jpa.JpaTransactionManager
JpaTransactionManager | public JpaTransactionManager(EntityManagerFactory emf)(Code) | | Create a new JpaTransactionManager instance.
Parameters: emf - EntityManagerFactory to manage transactions for |
afterPropertiesSet | public void afterPropertiesSet()(Code) | | Eagerly initialize the JPA dialect, creating a default one
for the specified EntityManagerFactory if none set.
Auto-detect the EntityManagerFactory's DataSource, if any.
|
createEntityManagerForTransaction | protected EntityManager createEntityManagerForTransaction()(Code) | | Create a JPA EntityManager to be used for a transaction.
The default implementation checks whether the EntityManagerFactory
is a Spring proxy and unwraps it first.
See Also: javax.persistence.EntityManagerFactory.createEntityManager See Also: EntityManagerFactoryInfo.getNativeEntityManagerFactory |
doCleanupAfterCompletion | protected void doCleanupAfterCompletion(Object transaction)(Code) | | |
getDataSource | public DataSource getDataSource()(Code) | | Return the JDBC DataSource that this instance manages transactions for.
|
getEntityManagerFactory | public EntityManagerFactory getEntityManagerFactory()(Code) | | Return the EntityManagerFactory that this instance should manage transactions for.
|
getJpaDialect | public JpaDialect getJpaDialect()(Code) | | Return the JPA dialect to use for this transaction manager.
|
getJpaPropertyMap | public Map getJpaPropertyMap()(Code) | | Allow Map access to the JPA properties to be passed to the persistence
provider, with the option to add or override specific entries.
Useful for specifying entries directly, for example via "jpaPropertyMap[myKey]".
|
isExistingTransaction | protected boolean isExistingTransaction(Object transaction)(Code) | | |
setDataSource | public void setDataSource(DataSource dataSource)(Code) | | Set the JDBC DataSource that this instance should manage transactions for.
The DataSource should match the one used by the JPA EntityManagerFactory:
for example, you could specify the same JNDI DataSource for both.
If the EntityManagerFactory uses a known DataSource as connection factory,
the DataSource will be autodetected: You can still explictly specify the
DataSource, but you don't need to in this case.
A transactional JDBC Connection for this DataSource will be provided to
application code accessing this DataSource directly via DataSourceUtils
or JdbcTemplate. The Connection will be taken from the JPA EntityManager.
Note that you need to use a JPA dialect for a specific JPA implementation
to allow for exposing JPA transactions as JDBC transactions.
The DataSource specified here should be the target DataSource to manage
transactions for, not a TransactionAwareDataSourceProxy. Only data access
code may work with TransactionAwareDataSourceProxy, while the transaction
manager needs to work on the underlying target DataSource. If there's
nevertheless a TransactionAwareDataSourceProxy passed in, it will be
unwrapped to extract its target DataSource.
See Also: EntityManagerFactoryInfo.getDataSource See Also: JpaTransactionManager.setJpaDialect See Also: org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy See Also: org.springframework.jdbc.datasource.DataSourceUtils See Also: org.springframework.jdbc.core.JdbcTemplate |
setEntityManagerFactory | public void setEntityManagerFactory(EntityManagerFactory emf)(Code) | | Set the EntityManagerFactory that this instance should manage transactions for.
|
setJpaDialect | public void setJpaDialect(JpaDialect jpaDialect)(Code) | | Set the JPA dialect to use for this transaction manager.
Used for vendor-specific transaction management and JDBC connection exposure.
If the EntityManagerFactory uses a known JpaDialect, it will be autodetected:
You can still explictly specify the DataSource, but you don't need to in this case.
The dialect object can be used to retrieve the underlying JDBC connection
and thus allows for exposing JPA transactions as JDBC transactions.
See Also: EntityManagerFactoryInfo.getJpaDialect See Also: JpaDialect.beginTransaction See Also: JpaDialect.getJdbcConnection |
setJpaProperties | public void setJpaProperties(Properties jpaProperties)(Code) | | Specify JPA properties, to be passed into
EntityManagerFactory.createEntityManager(Map) (if any).
Can be populated with a String "value" (parsed via PropertiesEditor)
or a "props" element in XML bean definitions.
See Also: javax.persistence.EntityManagerFactory.createEntityManager(java.util.Map) |
setJpaPropertyMap | public void setJpaPropertyMap(Map jpaProperties)(Code) | | Specify JPA properties as a Map, to be passed into
EntityManagerFactory.createEntityManager(Map) (if any).
Can be populated with a "map" or "props" element in XML bean definitions.
See Also: javax.persistence.EntityManagerFactory.createEntityManager(java.util.Map) |
shouldCommitOnGlobalRollbackOnly | protected boolean shouldCommitOnGlobalRollbackOnly()(Code) | | This implementation returns "true": a JPA commit will properly handle
transactions that have been marked rollback-only at a global level.
|
Fields inherited from org.springframework.transaction.support.AbstractPlatformTransactionManager | final public static int SYNCHRONIZATION_ALWAYS(Code)(Java Doc) final public static int SYNCHRONIZATION_NEVER(Code)(Java Doc) final public static int SYNCHRONIZATION_ON_ACTUAL_TRANSACTION(Code)(Java Doc) protected transient Log logger(Code)(Java Doc)
|
Methods inherited from org.springframework.transaction.support.AbstractPlatformTransactionManager | final public void commit(TransactionStatus status) throws TransactionException(Code)(Java Doc) protected int determineTimeout(TransactionDefinition definition)(Code)(Java Doc) abstract protected void doBegin(Object transaction, TransactionDefinition definition) throws TransactionException(Code)(Java Doc) protected void doCleanupAfterCompletion(Object transaction)(Code)(Java Doc) abstract protected void doCommit(DefaultTransactionStatus status) throws TransactionException(Code)(Java Doc) abstract protected Object doGetTransaction() throws TransactionException(Code)(Java Doc) protected void doResume(Object transaction, Object suspendedResources) throws TransactionException(Code)(Java Doc) abstract protected void doRollback(DefaultTransactionStatus status) throws TransactionException(Code)(Java Doc) protected void doSetRollbackOnly(DefaultTransactionStatus status) throws TransactionException(Code)(Java Doc) protected Object doSuspend(Object transaction) throws TransactionException(Code)(Java Doc) final public int getDefaultTimeout()(Code)(Java Doc) final public TransactionStatus getTransaction(TransactionDefinition definition) throws TransactionException(Code)(Java Doc) final public int getTransactionSynchronization()(Code)(Java Doc) final protected void invokeAfterCompletion(List synchronizations, int completionStatus)(Code)(Java Doc) protected boolean isExistingTransaction(Object transaction) throws TransactionException(Code)(Java Doc) final public boolean isFailEarlyOnGlobalRollbackOnly()(Code)(Java Doc) final public boolean isGlobalRollbackOnParticipationFailure()(Code)(Java Doc) final public boolean isNestedTransactionAllowed()(Code)(Java Doc) final public boolean isRollbackOnCommitFailure()(Code)(Java Doc) protected DefaultTransactionStatus newTransactionStatus(TransactionDefinition definition, Object transaction, boolean newTransaction, boolean newSynchronization, boolean debug, Object suspendedResources)(Code)(Java Doc) protected void registerAfterCompletionWithExistingTransaction(Object transaction, List synchronizations) throws TransactionException(Code)(Java Doc) final protected void resume(Object transaction, SuspendedResourcesHolder resourcesHolder) throws TransactionException(Code)(Java Doc) final public void rollback(TransactionStatus status) throws TransactionException(Code)(Java Doc) final public void setDefaultTimeout(int defaultTimeout)(Code)(Java Doc) final public void setFailEarlyOnGlobalRollbackOnly(boolean failEarlyOnGlobalRollbackOnly)(Code)(Java Doc) final public void setGlobalRollbackOnParticipationFailure(boolean globalRollbackOnParticipationFailure)(Code)(Java Doc) final public void setNestedTransactionAllowed(boolean nestedTransactionAllowed)(Code)(Java Doc) final public void setRollbackOnCommitFailure(boolean rollbackOnCommitFailure)(Code)(Java Doc) final public void setTransactionSynchronization(int transactionSynchronization)(Code)(Java Doc) final public void setTransactionSynchronizationName(String constantName)(Code)(Java Doc) protected boolean shouldCommitOnGlobalRollbackOnly()(Code)(Java Doc) final protected SuspendedResourcesHolder suspend(Object transaction) throws TransactionException(Code)(Java Doc) final protected void triggerBeforeCommit(DefaultTransactionStatus status)(Code)(Java Doc) final protected void triggerBeforeCompletion(DefaultTransactionStatus status)(Code)(Java Doc) protected boolean useSavepointForNestedTransaction()(Code)(Java Doc)
|
|
|
|