本文整理匯總了Java中javax.persistence.spi.PersistenceUnitInfo.getJtaDataSource方法的典型用法代碼示例。如果您正苦於以下問題:Java PersistenceUnitInfo.getJtaDataSource方法的具體用法?Java PersistenceUnitInfo.getJtaDataSource怎麽用?Java PersistenceUnitInfo.getJtaDataSource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.persistence.spi.PersistenceUnitInfo
的用法示例。
在下文中一共展示了PersistenceUnitInfo.getJtaDataSource方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createContainerEntityManagerFactory
import javax.persistence.spi.PersistenceUnitInfo; //導入方法依賴的package包/類
@Override
public EntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo info, Map map) {
log.info("create container JdbcBridgeEntityManagerFactory");
registerCibetDriver();
logInfo(info, map);
return new JdbcBridgeEntityManagerFactory(info.getJtaDataSource());
// String err = this.getClass().getName() + " cannot be applied/injected in a container managed environment.";
// log.error(err);
// throw new IllegalStateException(err);
}
示例2: getDataSource
import javax.persistence.spi.PersistenceUnitInfo; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*/
@Override
public DataSource getDataSource() {
PersistenceUnitInfo pui = internalFactoryBean.getPersistenceUnitInfo();
if (internalFactoryBean.getPersistenceUnitInfo() != null) {
return (pui.getJtaDataSource() != null ?
pui.getJtaDataSource() :
pui.getNonJtaDataSource());
}
return (persistenceUnitManager.getDefaultJtaDataSource() != null ?
persistenceUnitManager.getDefaultJtaDataSource() :
this.persistenceUnitManager.getDefaultDataSource());
}
示例3: PersistenceUnitSwapDescriptor
import javax.persistence.spi.PersistenceUnitInfo; //導入方法依賴的package包/類
/**
* Constructor with {@link PersistenceUnitInfoDescriptor} to set editable
* properties
*
* @param persistenceUnitInfo
*/
public PersistenceUnitSwapDescriptor(PersistenceUnitInfo persistenceUnitInfo) {
super(persistenceUnitInfo);
this.nonJtaDataSource = persistenceUnitInfo.getNonJtaDataSource();
this.jtaDataSource = persistenceUnitInfo.getJtaDataSource();
this.managedClassNames = persistenceUnitInfo.getManagedClassNames();
}
示例4: 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;
}