use of org.springframework.orm.jpa.JpaTransactionManager in project cas by apereo.
the class GoogleAuthenticatorJpaConfiguration method transactionManagerGoogleAuthenticator.
@Autowired
@Bean
public PlatformTransactionManager transactionManagerGoogleAuthenticator(@Qualifier("googleAuthenticatorEntityManagerFactory") final EntityManagerFactory emf) {
final JpaTransactionManager mgmr = new JpaTransactionManager();
mgmr.setEntityManagerFactory(emf);
return mgmr;
}
use of org.springframework.orm.jpa.JpaTransactionManager in project cas by apereo.
the class JpaEventsConfiguration method transactionManagerEvents.
@Autowired
@Bean
public PlatformTransactionManager transactionManagerEvents(@Qualifier("eventsEntityManagerFactory") final EntityManagerFactory emf) {
final JpaTransactionManager mgmr = new JpaTransactionManager();
mgmr.setEntityManagerFactory(emf);
return mgmr;
}
use of org.springframework.orm.jpa.JpaTransactionManager in project Activiti by Activiti.
the class DatabaseConfiguration method annotationDrivenTransactionManager.
@Bean(name = "transactionManager")
public PlatformTransactionManager annotationDrivenTransactionManager() {
JpaTransactionManager transactionManager = new JpaTransactionManager();
transactionManager.setEntityManagerFactory(entityManagerFactory());
return transactionManager;
}
use of org.springframework.orm.jpa.JpaTransactionManager in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850OsgpCoreDbApiPersistenceConfig method iec61850OsgpCoreDbApiTransactionManager.
/**
* Method for creating the Transaction Manager.
*
* @return JpaTransactionManager
* @throws ClassNotFoundException
* when class not found
*/
@Bean
public JpaTransactionManager iec61850OsgpCoreDbApiTransactionManager() throws Iec61850CoreDbApiException {
final JpaTransactionManager transactionManager = new JpaTransactionManager();
try {
transactionManager.setEntityManagerFactory(this.iec61850OsgpCoreDbApiEntityManagerFactory().getObject());
transactionManager.setTransactionSynchronization(JpaTransactionManager.SYNCHRONIZATION_ALWAYS);
} catch (final ClassNotFoundException e) {
final String msg = "Error in creating transaction manager bean";
LOGGER.error(msg, e);
throw new Iec61850CoreDbApiException(msg, e);
}
return transactionManager;
}
use of org.springframework.orm.jpa.JpaTransactionManager in project spring-framework by spring-projects.
the class PersistenceContextTransactionTests method setUp.
@Before
public void setUp() throws Exception {
factory = mock(EntityManagerFactory.class);
manager = mock(EntityManager.class);
tx = mock(EntityTransaction.class);
JpaTransactionManager tm = new JpaTransactionManager(factory);
tt = new TransactionTemplate(tm);
given(factory.createEntityManager()).willReturn(manager);
given(manager.getTransaction()).willReturn(tx);
given(manager.isOpen()).willReturn(true);
bean = new EntityManagerHoldingBean();
@SuppressWarnings("serial") PersistenceAnnotationBeanPostProcessor pabpp = new PersistenceAnnotationBeanPostProcessor() {
@Override
protected EntityManagerFactory findEntityManagerFactory(String unitName, String requestingBeanName) {
return factory;
}
};
pabpp.postProcessPropertyValues(null, null, bean, "bean");
assertTrue(TransactionSynchronizationManager.getResourceMap().isEmpty());
assertFalse(TransactionSynchronizationManager.isSynchronizationActive());
}
Aggregations