本文整理匯總了Java中javax.persistence.spi.PersistenceUnitInfo.getTransactionType方法的典型用法代碼示例。如果您正苦於以下問題:Java PersistenceUnitInfo.getTransactionType方法的具體用法?Java PersistenceUnitInfo.getTransactionType怎麽用?Java PersistenceUnitInfo.getTransactionType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.persistence.spi.PersistenceUnitInfo
的用法示例。
在下文中一共展示了PersistenceUnitInfo.getTransactionType方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createProxy
import javax.persistence.spi.PersistenceUnitInfo; //導入方法依賴的package包/類
/**
* Actually create the EntityManager proxy.
* @param rawEntityManager raw EntityManager
* @param emfInfo the EntityManagerFactoryInfo to obtain the
* EntityManagerPlusOperations and PersistenceUnitInfo from
* @param containerManaged whether to follow container-managed EntityManager
* or application-managed EntityManager semantics
* @return the EntityManager proxy
*/
private static EntityManager createProxy(
EntityManager rawEntityManager, EntityManagerFactoryInfo emfInfo, boolean containerManaged) {
Assert.notNull(emfInfo, "EntityManagerFactoryInfo must not be null");
JpaDialect jpaDialect = emfInfo.getJpaDialect();
EntityManagerPlusOperations plusOperations = null;
if (jpaDialect != null && jpaDialect.supportsEntityManagerPlusOperations()) {
plusOperations = jpaDialect.getEntityManagerPlusOperations(rawEntityManager);
}
PersistenceUnitInfo pui = emfInfo.getPersistenceUnitInfo();
Boolean jta = (pui != null ? pui.getTransactionType() == PersistenceUnitTransactionType.JTA : null);
return createProxy(rawEntityManager, emfInfo.getEntityManagerInterface(),
emfInfo.getBeanClassLoader(), plusOperations, jpaDialect, jta, containerManaged);
}
示例2: isJtaEnabled
import javax.persistence.spi.PersistenceUnitInfo; //導入方法依賴的package包/類
private boolean isJtaEnabled() throws Exception {
EntityManagerFactoryDelegate delegate =
entityManagerFactory.unwrap(EntityManagerFactoryDelegate.class);
PersistenceUnitInfo info = delegate.getSetupImpl().getPersistenceUnitInfo();
return info.getJtaDataSource() != null && info.getTransactionType() == PersistenceUnitTransactionType.JTA;
}
示例3: createProxy
import javax.persistence.spi.PersistenceUnitInfo; //導入方法依賴的package包/類
/**
* 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);
}