本文整理汇总了Java中javax.persistence.spi.PersistenceUnitInfo.getNonJtaDataSource方法的典型用法代码示例。如果您正苦于以下问题:Java PersistenceUnitInfo.getNonJtaDataSource方法的具体用法?Java PersistenceUnitInfo.getNonJtaDataSource怎么用?Java PersistenceUnitInfo.getNonJtaDataSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.persistence.spi.PersistenceUnitInfo
的用法示例。
在下文中一共展示了PersistenceUnitInfo.getNonJtaDataSource方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolveDataSource
import javax.persistence.spi.PersistenceUnitInfo; //导入方法依赖的package包/类
private DataSource resolveDataSource(PersistenceUnitInfo info) {
String url = null;
String user = null;
String password = null;
if (info.getProperties().containsKey(HIBERNATE_URL)) {
url = info.getProperties().getProperty(HIBERNATE_URL);
user = info.getProperties().getProperty(HIBERNATE_USER);
password = info.getProperties().getProperty(HIBERNATE_PASSWORD);
return new DefaultDataSource(url, user, password);
}
if (info.getProperties().containsKey(JAVAX_URL)) {
url = info.getProperties().getProperty(JAVAX_URL);
user = info.getProperties().getProperty(JAVAX_USER);
password = info.getProperties().getProperty(JAVAX_PASSWORD);
return new DefaultDataSource(url, user, password);
}
return info.getNonJtaDataSource();
}
示例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();
}