本文整理汇总了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;
}