public abstract class EntityManagerFactoryAccessor extends ObjectSE implements BeanFactoryAware
EntityManager
EE を取得するために、JPA EntityManagerFactory
EE にアクセスする必要があるクラスの基本クラス。共通のプロパティを定義します。EntityManagerFactoryUtils
コンストラクターと説明 |
---|
EntityManagerFactoryAccessor() |
修飾子と型 | メソッドと説明 |
---|---|
protected EntityManagerEE | createEntityManager() このアクセサーの EntityManagerFactory から新しい EntityManager を取得します。 |
EntityManagerFactoryEE | getEntityManagerFactory() EntityManagers の作成に使用される JPA EntityManagerFactory を返します。 |
MapSE<StringSE, ObjectSE> | getJpaPropertyMap() 特定のエントリを追加または上書きするオプションを使用して、JPA プロパティへのマップアクセスを永続性プロバイダーに渡すことができます。 |
StringSE | getPersistenceUnitName() EntityManagerFactory にアクセスする永続性ユニットの名前を返します(存在する場合)。 |
protected EntityManagerEE | getTransactionalEntityManager() このアクセサーの EntityManagerFactory のトランザクション EntityManager を取得します(存在する場合)。 |
protected EntityManagerFactoryEE | obtainEntityManagerFactory() 実際に使用するために EntityManagerFactory を取得します。 |
void | setBeanFactory(BeanFactory beanFactory) 明示的に設定されていない場合は、永続ユニット名で EntityManagerFactory を取得します。 |
void | setEntityManagerFactory(EntityManagerFactoryEE emf) EntityManagers の作成に使用する JPA EntityManagerFactory を設定します。 |
void | setJpaProperties(PropertiesSE jpaProperties) EntityManagerFactory.createEntityManager(Map) (存在する場合)に渡される JPA プロパティを指定します。 |
void | setJpaPropertyMap(MapSE<StringSE, ObjectSE> jpaProperties) JPA プロパティをマップとして指定し、 EntityManagerFactory.createEntityManager(Map) (存在する場合)に渡されます。 |
void | setPersistenceUnitName(StringSE persistenceUnitName) EntityManagerFactory にアクセスする永続性ユニットの名前を設定します。 |
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSE
protected final Log logger
public void setEntityManagerFactory(@Nullable EntityManagerFactoryEE emf)
@Nullable public EntityManagerFactoryEE getEntityManagerFactory()
protected final EntityManagerFactoryEE obtainEntityManagerFactory()
null
)IllegalStateExceptionSE
- EntityManagerFactory セットがない場合 public void setPersistenceUnitName(@Nullable StringSE persistenceUnitName)
これは、直接参照によって EntityManagerFactory を指定する代わりに、代わりに永続化ユニット名で解決します。EntityManagerFactory も永続ユニット名も指定されていない場合、型 EntityManagerFactory の単一の固有 Bean を見つけることにより、デフォルト EntityManagerFactory が取得されます。
@Nullable public StringSE getPersistenceUnitName()
public void setJpaProperties(PropertiesSE jpaProperties)
EntityManagerFactory.createEntityManager(Map)
(存在する場合)に渡される JPA プロパティを指定します。文字列 "value" (PropertiesEditor で解析)または XML Bean 定義の "props" 要素を入力できます。
public void setJpaPropertyMap(@Nullable MapSE<StringSE,ObjectSE> jpaProperties)
EntityManagerFactory.createEntityManager(Map)
(存在する場合)に渡されます。XML Bean 定義の「マップ」または "props" 要素を取り込むことができます。
public MapSE<StringSE,ObjectSE> getJpaPropertyMap()
"jpaPropertyMap [myKey]" などを介して、エントリを直接指定するのに便利です。
public void setBeanFactory(BeanFactory beanFactory) throws BeansException
BeanFactoryAware
の setBeanFactory
beanFactory
- 所有 BeanFactory(非 null
)。Bean は、ファクトリのメソッドをすぐに呼び出すことができます。BeansException
- 初期化エラーの場合 setPersistenceUnitName(java.lang.String)
protected EntityManagerEE createEntityManager() throws IllegalStateExceptionSE
サブクラスでオーバーライドして、特定の EntityManager バリアントを作成できます。
IllegalStateExceptionSE
- このアクセサーが EntityManagerFactory で構成されていない場合 EntityManagerFactory.createEntityManager()
EE, EntityManagerFactory.createEntityManager(java.util.Map)
EE@Nullable protected EntityManagerEE getTransactionalEntityManager() throws IllegalStateExceptionSE
null
IllegalStateExceptionSE
- このアクセサーが EntityManagerFactory で構成されていない場合 EntityManagerFactoryUtils.getTransactionalEntityManager(javax.persistence.EntityManagerFactory)
, EntityManagerFactoryUtils.getTransactionalEntityManager(javax.persistence.EntityManagerFactory, java.util.Map)