Package net.officefloor.jpa
Class JpaManagedObjectSource
java.lang.Object
net.officefloor.frame.api.managedobject.source.impl.AbstractAsyncManagedObjectSource<O,F>
net.officefloor.frame.api.managedobject.source.impl.AbstractManagedObjectSource<Indexed,None>
net.officefloor.jpa.JpaManagedObjectSource
- All Implemented Interfaces:
ManagedObjectSource<Indexed,None>
- Direct Known Subclasses:
DataNucleusJpaManagedObjectSource,HibernateJpaManagedObjectSource
JPA
ManagedObjectSource.- Author:
- Daniel Sagenschneider
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDependency type.static interfaceWraps theEntityManager.static interfaceFactory creating theEntityManagerwrapper.classJPAManagedObject.static interfaceFunctionalInterfaceto create theEntityManagerFactory.Nested classes/interfaces inherited from class net.officefloor.frame.api.managedobject.source.impl.AbstractAsyncManagedObjectSource
AbstractAsyncManagedObjectSource.DependencyLabeller<K extends Enum<K>>, AbstractAsyncManagedObjectSource.ExecutionLabeller, AbstractAsyncManagedObjectSource.Labeller<K extends Enum<K>>, AbstractAsyncManagedObjectSource.MetaDataContext<O extends Enum<O>,F extends Enum<F>>, AbstractAsyncManagedObjectSource.SpecificationContext -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidbeginTransaction(jakarta.persistence.EntityManager entityManager) Begins the transaction on theEntityManager.static voidcommitTransaction(jakarta.persistence.EntityManager entityManager) Commits the transaction on theEntityManager.Obtains theConnection.protected ManagedObjectSynchronously obtains theManagedObject.getPersistenceFactory(SourceContext context) Obtains theJpaManagedObjectSource.PersistenceFactory.protected booleanIndicates if required to run withinEntityTransaction.protected voidOverridden to load meta-data.protected voidOverridden to load specifications.Methods inherited from class net.officefloor.frame.api.managedobject.source.impl.AbstractManagedObjectSource
sourceManagedObjectMethods inherited from class net.officefloor.frame.api.managedobject.source.impl.AbstractAsyncManagedObjectSource
getSpecification, init, start, stop
-
Field Details
-
Constructor Details
-
JpaManagedObjectSource
public JpaManagedObjectSource()
-
-
Method Details
-
beginTransaction
public static void beginTransaction(jakarta.persistence.EntityManager entityManager) Begins the transaction on the
EntityManager.As
OfficeFloormay manage the transaction for theEntityManager, it can not be begun. This enables beginning the transaction.- Parameters:
entityManager-EntityManager.
-
commitTransaction
public static void commitTransaction(jakarta.persistence.EntityManager entityManager) Commits the transaction on the
EntityManager.As
OfficeFloormay manage the transaction for theEntityManager, it can not be committed. This enables committing the transaction.- Parameters:
entityManager-EntityManager.
-
getConnection
Obtains theConnection.- Returns:
Connection.
-
getPersistenceFactory
protected JpaManagedObjectSource.PersistenceFactory getPersistenceFactory(SourceContext context) throws Exception Obtains the
JpaManagedObjectSource.PersistenceFactory.Specific vendor implementations may override this method to specify the
JpaManagedObjectSource.PersistenceFactory.By default, this method uses the
PROPERTY_PERSISTENCE_FACTORYPropertyto load theJpaManagedObjectSource.PersistenceFactory.- Parameters:
context-SourceContext.- Returns:
JpaManagedObjectSource.PersistenceFactory.- Throws:
Exception- If fails to create theJpaManagedObjectSource.PersistenceFactory.
-
isRunWithinTransaction
protected boolean isRunWithinTransaction()Indicates if required to run withinEntityTransaction.- Returns:
trueif required to run withinEntityTransaction.
-
loadSpecification
Description copied from class:AbstractAsyncManagedObjectSourceOverridden to load specifications.- Specified by:
loadSpecificationin classAbstractAsyncManagedObjectSource<Indexed,None> - Parameters:
context- Specifications.
-
loadMetaData
protected void loadMetaData(AbstractAsyncManagedObjectSource.MetaDataContext<Indexed, None> context) throws ExceptionDescription copied from class:AbstractAsyncManagedObjectSourceOverridden to load meta-data.- Specified by:
loadMetaDatain classAbstractAsyncManagedObjectSource<Indexed,None> - Parameters:
context- Meta-data.- Throws:
Exception- If fails to load the meta-data.
-
getManagedObject
Description copied from class:AbstractManagedObjectSourceSynchronously obtains theManagedObject.- Specified by:
getManagedObjectin classAbstractManagedObjectSource<Indexed,None> - Returns:
ManagedObject.- Throws:
Throwable- If fails to obtain theManagedObject.
-