當前位置: 首頁>>代碼示例>>Java>>正文


Java PersistenceUnitInfo.getNonJtaDataSource方法代碼示例

本文整理匯總了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();
}
 
開發者ID:Wolfgang-Winter,項目名稱:cibet,代碼行數:22,代碼來源:JdbcBridgeProvider.java

示例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());
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:16,代碼來源:KradEntityManagerFactoryBean.java

示例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();
   }
 
開發者ID:levants,項目名稱:lightmare,代碼行數:13,代碼來源:PersistenceUnitSwapDescriptor.java


注:本文中的javax.persistence.spi.PersistenceUnitInfo.getNonJtaDataSource方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。