Java Code Examples for javax.persistence.spi.PersistenceUnitInfo#getTransactionType()

The following examples show how to use javax.persistence.spi.PersistenceUnitInfo#getTransactionType() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KradEclipseLinkEntityManagerFactoryBeanTest.java    From rice with Educational Community License v2.0 4 votes vote down vote up
private boolean isJtaEnabled() throws Exception {
    EntityManagerFactoryDelegate delegate =
            entityManagerFactory.unwrap(EntityManagerFactoryDelegate.class);
    PersistenceUnitInfo info = delegate.getSetupImpl().getPersistenceUnitInfo();
    return info.getJtaDataSource() != null && info.getTransactionType() == PersistenceUnitTransactionType.JTA;
}
 
Example 2
Source File: ExtendedEntityManagerCreator.java    From spring-analysis-note with MIT License 3 votes vote down vote up
/**
 * Actually create the EntityManager proxy.
 * @param rawEntityManager raw EntityManager
 * @param emfInfo the EntityManagerFactoryInfo to obtain the JpaDialect
 * and PersistenceUnitInfo from
 * @param containerManaged whether to follow container-managed EntityManager
 * or application-managed EntityManager semantics
 * @param synchronizedWithTransaction whether to automatically join ongoing
 * transactions (according to the JPA 2.1 SynchronizationType rules)
 * @return the EntityManager proxy
 */
private static EntityManager createProxy(EntityManager rawEntityManager,
		EntityManagerFactoryInfo emfInfo, boolean containerManaged, boolean synchronizedWithTransaction) {

	Assert.notNull(emfInfo, "EntityManagerFactoryInfo must not be null");
	JpaDialect jpaDialect = emfInfo.getJpaDialect();
	PersistenceUnitInfo pui = emfInfo.getPersistenceUnitInfo();
	Boolean jta = (pui != null ? pui.getTransactionType() == PersistenceUnitTransactionType.JTA : null);
	return createProxy(rawEntityManager, emfInfo.getEntityManagerInterface(),
			emfInfo.getBeanClassLoader(), jpaDialect, jta, containerManaged, synchronizedWithTransaction);
}
 
Example 3
Source File: ExtendedEntityManagerCreator.java    From java-technology-stack with MIT License 3 votes vote down vote up
/**
 * Actually create the EntityManager proxy.
 * @param rawEntityManager raw EntityManager
 * @param emfInfo the EntityManagerFactoryInfo to obtain the JpaDialect
 * and PersistenceUnitInfo from
 * @param containerManaged whether to follow container-managed EntityManager
 * or application-managed EntityManager semantics
 * @param synchronizedWithTransaction whether to automatically join ongoing
 * transactions (according to the JPA 2.1 SynchronizationType rules)
 * @return the EntityManager proxy
 */
private static EntityManager createProxy(EntityManager rawEntityManager,
		EntityManagerFactoryInfo emfInfo, boolean containerManaged, boolean synchronizedWithTransaction) {

	Assert.notNull(emfInfo, "EntityManagerFactoryInfo must not be null");
	JpaDialect jpaDialect = emfInfo.getJpaDialect();
	PersistenceUnitInfo pui = emfInfo.getPersistenceUnitInfo();
	Boolean jta = (pui != null ? pui.getTransactionType() == PersistenceUnitTransactionType.JTA : null);
	return createProxy(rawEntityManager, emfInfo.getEntityManagerInterface(),
			emfInfo.getBeanClassLoader(), jpaDialect, jta, containerManaged, synchronizedWithTransaction);
}
 
Example 4
Source File: ExtendedEntityManagerCreator.java    From lams with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Actually create the EntityManager proxy.
 * @param rawEntityManager raw EntityManager
 * @param emfInfo the EntityManagerFactoryInfo to obtain the JpaDialect
 * and PersistenceUnitInfo from
 * @param containerManaged whether to follow container-managed EntityManager
 * or application-managed EntityManager semantics
 * @param synchronizedWithTransaction whether to automatically join ongoing
 * transactions (according to the JPA 2.1 SynchronizationType rules)
 * @return the EntityManager proxy
 */
private static EntityManager createProxy(EntityManager rawEntityManager,
		EntityManagerFactoryInfo emfInfo, boolean containerManaged, boolean synchronizedWithTransaction) {

	Assert.notNull(emfInfo, "EntityManagerFactoryInfo must not be null");
	JpaDialect jpaDialect = emfInfo.getJpaDialect();
	PersistenceUnitInfo pui = emfInfo.getPersistenceUnitInfo();
	Boolean jta = (pui != null ? pui.getTransactionType() == PersistenceUnitTransactionType.JTA : null);
	return createProxy(rawEntityManager, emfInfo.getEntityManagerInterface(),
			emfInfo.getBeanClassLoader(), jpaDialect, jta, containerManaged, synchronizedWithTransaction);
}
 
Example 5
Source File: ExtendedEntityManagerCreator.java    From spring4-understanding with Apache License 2.0 3 votes vote down vote up
/**
 * Actually create the EntityManager proxy.
 * @param rawEntityManager raw EntityManager
 * @param emfInfo the EntityManagerFactoryInfo to obtain the JpaDialect
 * and PersistenceUnitInfo from
 * @param containerManaged whether to follow container-managed EntityManager
 * or application-managed EntityManager semantics
 * @param synchronizedWithTransaction whether to automatically join ongoing
 * transactions (according to the JPA 2.1 SynchronizationType rules)
 * @return the EntityManager proxy
 */
private static EntityManager createProxy(EntityManager rawEntityManager,
		EntityManagerFactoryInfo emfInfo, boolean containerManaged, boolean synchronizedWithTransaction) {

	Assert.notNull(emfInfo, "EntityManagerFactoryInfo must not be null");
	JpaDialect jpaDialect = emfInfo.getJpaDialect();
	PersistenceUnitInfo pui = emfInfo.getPersistenceUnitInfo();
	Boolean jta = (pui != null ? pui.getTransactionType() == PersistenceUnitTransactionType.JTA : null);
	return createProxy(rawEntityManager, emfInfo.getEntityManagerInterface(),
			emfInfo.getBeanClassLoader(), jpaDialect, jta, containerManaged, synchronizedWithTransaction);
}