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

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

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

Persistence.getProviders介绍

暂无

代码示例

代码示例来源:origin: org.hibernate.javax.persistence/hibernate-jpa-2.0-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;
  List<PersistenceProvider> providers = getProviders();
  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: org.hibernate.javax.persistence/hibernate-jpa-2.1-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;
  List<PersistenceProvider> providers = getProviders();
  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: org.hibernate.javax.persistence/hibernate-jpa-2.1-api

/**
 * Create database schemas and/or tables and/or create DDL scripts as determined by the supplied properties
 *
 * Called when schema generation is to occur as a separate phase from creation of the entity manager factory.
 *
 * @param persistenceUnitName the name of the persistence unit
 * @param properties properties for schema generation; these may also contain provider-specific properties. The
 * values of these properties override any values that may have been configured elsewhere.
 *
 * @throws PersistenceException if insufficient or inconsistent configuration information is provided or if schema
 * generation otherwise fails.
 */
public static void generateSchema(String persistenceUnitName, Map properties) {
  List<PersistenceProvider> providers = getProviders();
  for ( PersistenceProvider provider : providers ) {
    final boolean generated = provider.generateSchema( persistenceUnitName, properties );
    if ( generated ) {
      return;
    }
  }
  throw new PersistenceException(
      "No persistence provider found for schema generation for persistence-unit named " + persistenceUnitName
  );
}

代码示例来源:origin: org.apache.geronimo.specs/geronimo-jpa_2.1_spec

public static void generateSchema(String persistenceUnitName, Map properties) {
  final List<PersistenceProvider> providers = getProviders();
  for (final PersistenceProvider provider : providers) {
    if (provider.generateSchema( persistenceUnitName, properties)) {
      return;
    }
  }
  throw new PersistenceException("No provider for schema generation of unit '" + persistenceUnitName + "'");
}

代码示例来源:origin: org.apache.openjpa/openjpa-all

public static void generateSchema(String persistenceUnitName, Map properties) {
  final List<PersistenceProvider> providers = getProviders();
  for (final PersistenceProvider provider : providers) {
    if (provider.generateSchema( persistenceUnitName, properties)) {
      return;
    }
  }
  throw new PersistenceException("No provider for schema generation of unit '" + persistenceUnitName + "'");
}

代码示例来源:origin: org.datanucleus/javax.persistence

/**
 * Create database schemas and/or tables and/or create DDL scripts as determined by the supplied
 * properties Called when schema generation is to occur as a separate phase from creation of the entity manager factory.
 * @param persistenceUnitName the name of the persistence unit
 * @param properties properties for schema generation; these may also contain provider-specific
 * properties. The values of these properties override any values that may have been configured elsewhere.
 * @throws PersistenceException if insufficient or inconsistent configuration information is provided or if schema generation otherwise fails.
 */
public static void generateSchema(String persistenceUnitName, Map properties)
{
  List<PersistenceProvider> providers = getProviders();
  for (PersistenceProvider provider : providers)
  {
    final boolean generated = provider.generateSchema(persistenceUnitName, properties);
    if (generated)
    {
      return;
    }
  }
  throw new PersistenceException("No persistence provider found for schema generation for persistence-unit named " + persistenceUnitName);
}

代码示例来源:origin: org.datanucleus/javax.persistence

/**
 * 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;
  List<PersistenceProvider> providers = getProviders();
  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: org.apache.geronimo.specs/geronimo-jpa_2.1_spec

List<PersistenceProvider> providers = getProviders();

代码示例来源:origin: org.apache.openjpa/openjpa-all

List<PersistenceProvider> providers = getProviders();

相关文章