javax.persistence.Persistence.findAllProviders()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(1.4k)|赞(0)|评价(0)|浏览(177)

本文整理了Java中javax.persistence.Persistence.findAllProviders()方法的一些代码示例,展示了Persistence.findAllProviders()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Persistence.findAllProviders()方法的具体详情如下:
包路径:javax.persistence.Persistence
类名称:Persistence
方法名:findAllProviders

Persistence.findAllProviders介绍

暂无

代码示例

代码示例来源:origin: javax.persistence/persistence-api

providersFound = findAllProviders();
} catch (IOException exc){};

代码示例来源:origin: org.jboss.javaee/jboss-persistence-api

/**
 * Create and return an EntityManagerFactory for the named persistence unit using the given properties.
 *
 * @param persistenceUnitName The name of the persistence unit
 * @param properties Additional properties to use when creating the factory. The values of these properties override
 * any values that may have been configured elsewhere
 * @return The factory that creates EntityManagers configured according to the specified persistence unit
 */
public static EntityManagerFactory createEntityManagerFactory(String persistenceUnitName, Map properties) {
  EntityManagerFactory emf = null;
  if ( providers.size() == 0 ) {
    findAllProviders();
  }
  for ( PersistenceProvider provider : providers ) {
    emf = provider.createEntityManagerFactory( persistenceUnitName, properties );
    if ( emf != null ) break;
  }
  if ( emf == null ) {
    throw new PersistenceException( "No Persistence provider for EntityManager named " + persistenceUnitName );
  }
  return emf;
}

代码示例来源:origin: toplink.essentials/toplink-essentials

providersFound = findAllProviders();
} catch (IOException exc){};

相关文章