PersistenceProvider (Java EE 5 SDK)

Java

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


javax.persistence.spi Interface PersistenceProvider


public interface PersistenceProvider

Interface implemented by a persistence provider. The implementation of this interface that is to be used for a given EntityManager is specified in persistence.xml file in the persistence archive. This interface is invoked by the Container when it needs to create an EntityManagerFactory, or by the Persistence class when running outside the Container.

从以下版本开始:
Java Persistence 1.0

方法摘要
 EntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo info, Map map)
          Called by the container when an EntityManagerFactory is to be created.
 EntityManagerFactory createEntityManagerFactory(String emName, Map map)
          Called by Persistence class when an EntityManagerFactory is to be created.
 

方法详细信息

createEntityManagerFactory

EntityManagerFactory createEntityManagerFactory(String emName,
                                                Map map)
Called by Persistence class when an EntityManagerFactory is to be created.

参数:
emName - The name of the persistence unit
map - A Map of properties for use by the persistence provider. These properties may be used to override the values of the corresponding elements in the persistence.xml file or specify values for properties not specified in the persistence.xml.
返回:
EntityManagerFactory for the persistence unit, or null if the provider is not the right provider

createContainerEntityManagerFactory

EntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo info,
                                                         Map map)
Called by the container when an EntityManagerFactory is to be created.

参数:
info - Metadata for use by the persistence provider
map - A Map of integration-level properties for use by the persistence provider. Can be null if there is no integration-level property.
返回:
EntityManagerFactory for the persistence unit specified by the metadata

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


提交错误或意见

版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。深圳电信培训中心.徐海蛟老师教学参考.