PersistenceProvider (Java EE 5)

Java EE API


javax.persistence.spi Interface PersistenceProvider


public interface PersistenceProvider


持久性提供者实现的接口。将用于给定 javax.persistence.EntityManager 的此接口实现可以在持久性归档文件中的 persistence.xml 文件中指定。Container 在需要创建 javax.persistence.EntityManagerFactory 时调用此接口;当 Persistence 类在 Container 以外运行时,由 Persistence 类调用此接口。
英文文档:

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.

Since:
Java Persistence 1.0

Method Summary
 EntityManagerFactory
 EntityManagerFactory
 

Method Detail

public EntityManagerFactory createEntityManagerFactory(String emName, java.util.Map<K, V> map)
要创建 javax.persistence.EntityManagerFactory 时由 Persistence 类调用。
emName 持久性单元的名称
map 供持久性提供者使用的属性映射。可以使用这些属性重写 persistence.xml 文件中相应元素的值,也可用于指定 persistence.xml 中尚未指定的属性的值。
return 持久性单元的 EntityManagerFactory;如果提供者不正确,则返回 null
英文文档:

createEntityManagerFactory

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

Parameters:
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.
Returns:
EntityManagerFactory for the persistence unit, or null if the provider is not the right provider

public EntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo info, java.util.Map<K, V> map)
要创建 javax.persistence.EntityManagerFactory 时由容器调用。
info 供持久性单元提供者使用的元数据
map 供持久性提供者使用的集成级属性映射。如果没有集成级属性,则为 null。
return 元数据所指定的持久性单元的 EntityManagerFactory
英文文档:

createContainerEntityManagerFactory

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

Parameters:
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.
Returns:
EntityManagerFactory for the persistence unit specified by the metadata


Submit a bug or feature

Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.

一看就知道只有菜鸟才干这么无知的事啦。

PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!