use of org.springframework.orm.jpa.JpaTransactionManager in project tutorials by eugenp.
the class PersistenceConfig method transactionManager.
@Bean
public PlatformTransactionManager transactionManager() {
final JpaTransactionManager transactionManager = new JpaTransactionManager();
transactionManager.setEntityManagerFactory(entityManagerFactory().getObject());
return transactionManager;
}
use of org.springframework.orm.jpa.JpaTransactionManager in project tutorials by eugenp.
the class PersistenceJPAConfig method transactionManager.
@Bean
public JpaTransactionManager transactionManager() {
JpaTransactionManager transactionManager = new JpaTransactionManager();
transactionManager.setEntityManagerFactory(entityManagerFactory().getObject());
return transactionManager;
}
use of org.springframework.orm.jpa.JpaTransactionManager in project survey by markoniemi.
the class JpaConfig method transactionManager.
@Bean
public PlatformTransactionManager transactionManager() {
JpaTransactionManager transactionManager = new JpaTransactionManager();
transactionManager.setEntityManagerFactory(entityManagerFactory().getObject());
return transactionManager;
}
use of org.springframework.orm.jpa.JpaTransactionManager in project BroadleafCommerce by BroadleafCommerce.
the class StreamingTransactionCapableUtil method runOptionalEntityManagerInViewOperation.
@Override
public void runOptionalEntityManagerInViewOperation(Runnable runnable) {
EntityManagerFactory emf = ((JpaTransactionManager) getTransactionManager()).getEntityManagerFactory();
boolean isEntityManagerInView = TransactionSynchronizationManager.hasResource(emf);
try {
if (!isEntityManagerInView) {
EntityManager em = emf.createEntityManager();
EntityManagerHolder emHolder = new EntityManagerHolder(em);
TransactionSynchronizationManager.bindResource(emf, emHolder);
}
runnable.run();
} finally {
if (!isEntityManagerInView) {
EntityManagerHolder emHolder = (EntityManagerHolder) TransactionSynchronizationManager.unbindResource(emf);
EntityManagerFactoryUtils.closeEntityManager(emHolder.getEntityManager());
}
}
}
use of org.springframework.orm.jpa.JpaTransactionManager in project spring-security by spring-projects.
the class ApplicationConfig method transactionManager.
@Bean
public PlatformTransactionManager transactionManager() {
JpaTransactionManager txManager = new JpaTransactionManager();
txManager.setEntityManagerFactory(entityManagerFactory().getObject());
return txManager;
}
Aggregations