本文整理匯總了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();
}