public abstract class AbstractGlobalEntityManagerFactory
extends com.phloc.scopes.singleton.GlobalSingleton
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractGlobalEntityManagerFactory(String sJdbcDriverClass,
String sJdbcURL,
String sUserName,
String sPassword,
String sPlatformClass,
String sPersistenceUnitName,
Map<String,Object> aAdditionalFactoryProperties)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
javax.persistence.EntityManager |
createEntityManager()
Create a new
EntityManager with the default properties - usually
this is suitable! |
javax.persistence.EntityManager |
createEntityManager(Map aMap)
Create a new
EntityManager with custom properties! |
protected javax.persistence.EntityManagerFactory |
customizeEntityManagerFactory(javax.persistence.EntityManagerFactory aEMF)
This method allows you to customize the created
EntityManagerFactory in any way. |
Map<String,Object> |
getAllFactoryProperties() |
javax.persistence.EntityManagerFactory |
getEntityManagerFactory() |
String |
getPersistenceUnitName() |
protected void |
onAfterInstantiation() |
protected void |
onDestroy()
Called when the global scope is destroyed (e.g. upon servlet context
shutdown)
|
getAllGlobalSingletons, getGlobalSingleton, getGlobalSingletonIfInstantiated, isGlobalSingletonInstantiatedgetAllSingletons, getSingleton, getSingletonIfInstantiated, getSingletonScopeKey, isDestroyed, isInDestruction, isInInstantiation, isInstantiated, isSingletonInstantiated, isUsableObject, onScopeDestruction, readAbstractSingletonFields, setDestroyed, setInDestruction, setInInstantiation, setInstantiated, toString, writeAbstractSingletonFieldsprotected AbstractGlobalEntityManagerFactory(@Nonnull@Nonempty String sJdbcDriverClass, @Nonnull@Nonempty String sJdbcURL, @Nullable String sUserName, @Nullable String sPassword, @Nonnull@Nonempty String sPlatformClass, @Nonnull@Nonempty String sPersistenceUnitName, @Nullable Map<String,Object> aAdditionalFactoryProperties)
sJdbcDriverClass - Name of the JDBC driver class. Must be a class implementing
java.sql.Driver.sJdbcURL - JDBC URLsUserName - User name to access the DB. May be null.sPassword - Password to access the DB. May be null.sPlatformClass - The EclipseLink platform name. May either be a fully qualified
class-name of a recognized abbreviation.sPersistenceUnitName - The name of the persistence unit as stated in the persistence.xmlaAdditionalFactoryProperties - An optional Map with properties for EntityManagerFactory.
This can even be used to overwrite the settings specified as
explicit parameters, so be careful. This map is applied after the
special properties are set! May be null.@Nonnull @OverrideOnDemand protected javax.persistence.EntityManagerFactory customizeEntityManagerFactory(@Nonnull javax.persistence.EntityManagerFactory aEMF)
EntityManagerFactory in any way. By default it is returned as
created.aEMF - The original EntityManagerFactory. Never null.EntityManagerFactory to use. May not be
null.@OverridingMethodsMustInvokeSuper protected void onAfterInstantiation()
onAfterInstantiation in class com.phloc.scopes.AbstractSingleton@OverridingMethodsMustInvokeSuper protected void onDestroy() throws Exception
onDestroy in class com.phloc.scopes.AbstractSingletonException - if closing fails@Nonnull @Nonempty public final String getPersistenceUnitName()
null nor empty.@Nonnull @ReturnsMutableCopy public final Map<String,Object> getAllFactoryProperties()
null.@Nonnull public final javax.persistence.EntityManagerFactory getEntityManagerFactory()
EntityManagerFactory. Never
null.@Nonnull public final javax.persistence.EntityManager createEntityManager()
EntityManager with the default properties - usually
this is suitable!EntityManager and never null.Copyright © 2006–2015 phloc systems. All rights reserved.