|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.clazzes.util.jpa.provider.EntityManagerFactoryFactory
public class EntityManagerFactoryFactory
This class is used to instantiate an EntityManagerFactory from a
PersistenceUnitInfo
instance.
This class mainly tackles the issue of setting the context class loader to
the class loader of the persistence unit, while
delegating the actual task to
PersistenceProvider.createContainerEntityManagerFactory(PersistenceUnitInfo, Map)
.
This is necessary for some buggy persistence providers, which otherwise fail to enhance classes.
A typical usage inside a blueprint container is:
<bp:reference id="persistenceProvider" interface="javax.persistence.spi.PersistenceProvider"/> <bp:bean id="entityManagerFactoryFactory" class="org.clazzes.util.jpa.provider.EntityManagerFactoryFactory"> <bp:property name="persistenceProvider" ref="persistenceProvider"/> <bp:property name="persistenceUnitInfo" ref="persistenceUnitInfo"/> <bp:property name="properties"> <bp:map> <bp:entry key="openjpa.Log" value="commons"/> </bp:map> </bp:property> </bp:bean>
Constructor Summary | |
---|---|
EntityManagerFactoryFactory()
|
Method Summary | |
---|---|
void |
addProperty(java.lang.String key,
java.lang.String value)
Add a vendor-specific property. |
javax.persistence.spi.PersistenceProvider |
getPersistenceProvider()
|
javax.persistence.spi.PersistenceUnitInfo |
getPersistenceUnitInfo()
|
java.util.Map<java.lang.String,java.lang.String> |
getProperties()
|
javax.persistence.EntityManagerFactory |
newEntityManagerFactory()
Call PersistenceProvider.createEntityManagerFactory(String, java.util.Map)
using the provided properties. |
void |
setPersistenceProvider(javax.persistence.spi.PersistenceProvider persistenceProvider)
|
void |
setPersistenceUnitInfo(javax.persistence.spi.PersistenceUnitInfo persistenceUnitInfo)
|
void |
setProperties(java.util.Map<java.lang.String,java.lang.String> properties)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EntityManagerFactoryFactory()
Method Detail |
---|
public javax.persistence.EntityManagerFactory newEntityManagerFactory()
PersistenceProvider.createEntityManagerFactory(String, java.util.Map)
using the provided properties. This method sets the context class loader to
the class loader of the provided context class in order to allow the JPA
provider to resolve the application's classes.
public javax.persistence.spi.PersistenceProvider getPersistenceProvider()
public void setPersistenceProvider(javax.persistence.spi.PersistenceProvider persistenceProvider)
persistenceProvider
- the persistenceProvider, which is typically a service reference
obtained by blueprint.public javax.persistence.spi.PersistenceUnitInfo getPersistenceUnitInfo()
PersistenceUnitInfoImpl
public void setPersistenceUnitInfo(javax.persistence.spi.PersistenceUnitInfo persistenceUnitInfo)
persistenceUnitInfo
- the persistenceUnitInfo to setPersistenceUnitInfoImpl
public java.util.Map<java.lang.String,java.lang.String> getProperties()
persistence.xml
.public void setProperties(java.util.Map<java.lang.String,java.lang.String> properties)
properties
- Additional vendor-specific properties,
which are configured outside persistence.xml
to set.public void addProperty(java.lang.String key, java.lang.String value)
key
- The name of the property.value
- The value of the property.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |