List of usage examples for org.springframework.orm.jpa JpaDialect prepareTransaction
@Nullable Object prepareTransaction(EntityManager entityManager, boolean readOnly, @Nullable String name) throws PersistenceException;
From source file:org.springframework.orm.jpa.EntityManagerFactoryUtils.java
/** * Prepare a transaction on the given EntityManager, if possible. * @param em the EntityManager to prepare * @param emf the EntityManagerFactory that the EntityManager has been created with * @return an arbitrary object that holds transaction data, if any * (to be passed into cleanupTransaction) * @see JpaDialect#prepareTransaction//from w w w.ja va 2 s . c om */ @Nullable private static Object prepareTransaction(EntityManager em, EntityManagerFactory emf) { if (emf instanceof EntityManagerFactoryInfo) { EntityManagerFactoryInfo emfInfo = (EntityManagerFactoryInfo) emf; JpaDialect jpaDialect = emfInfo.getJpaDialect(); if (jpaDialect != null) { return jpaDialect.prepareTransaction(em, TransactionSynchronizationManager.isCurrentTransactionReadOnly(), TransactionSynchronizationManager.getCurrentTransactionName()); } } return null; }