public Object beginTransaction(EntityManager entityManager,
TransactionDefinition definition) throws TransactionException, SQLException, PersistenceException {
super.beginTransaction(entityManager, definition);
OpenJPAEntityManager em = getOpenJPAEntityManager(entityManager);
if (!definition.isReadOnly()) {
// Like with TopLink, make sure to start the logic transaction early so that other
// participants using the connection (such as JdbcTemplate) run in a transaction.
em.beginStore();
}
return new OpenJpaTransactionData(em);
}
|