Package com.isomorphic.jpa
Interface EMFProviderInterface
- All Known Implementing Classes:
EMFProviderBMT
,EMFProviderCMT
,EMFProviderLMT
,EMFProviderNoTransactions
,EMFProviderSpring
public interface EMFProviderInterface
Interface used to provide specific implementation of
EntityManager
and transaction acquiring and handling.Implementation of this interface should provide at least two constructors:
- default constructor - will be used if implementation is used as default EMF provider
- constructor with single parameter of type
Properties
- will be used if implementation is used as additional named EMF provider
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Name of sub property for resource reference to entity manager.static final String
Name of sub property for resource reference to entity manager factory.static final String
Name of property for resource reference to entity manager.static final String
Name of property for resource reference to entity manager factory.static final String
Name of property for persistence unit name.static final String
Name of property for resource reference to transaction or transaction manager.static final String
Name of sub property for persistence unit name.static final String
Name of sub property for resource reference to transaction or transaction manager. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Commits specified transaction.jakarta.persistence.EntityManagerFactory
get()
ReturnsEntityManagerFactory
.jakarta.persistence.EntityManager
ReturnsEntityManager
for persistence operations.getTransaction
(jakarta.persistence.EntityManager em) Returns started transaction.void
returnEntityManager
(jakarta.persistence.EntityManager em) ClosesEntityManager
.void
Rolls back specified transaction.
-
Field Details
-
PERSISTENCE_UNIT_NAME
Name of sub property for persistence unit name.- See Also:
-
JPA_PERSISTENCE_UNIT_NAME
Name of property for persistence unit name.- See Also:
-
ENTITY_MANAGER
Name of sub property for resource reference to entity manager.- See Also:
-
JPA_ENTITY_MANAGER
Name of property for resource reference to entity manager.- See Also:
-
ENTITY_MANAGER_FACTORY
Name of sub property for resource reference to entity manager factory.- See Also:
-
JPA_ENTITY_MANAGER_FACTORY
Name of property for resource reference to entity manager factory.- See Also:
-
TRANSACTION
Name of sub property for resource reference to transaction or transaction manager.- See Also:
-
JPA_TRANSACTION
Name of property for resource reference to transaction or transaction manager.- See Also:
-
-
Method Details
-
get
jakarta.persistence.EntityManagerFactory get()ReturnsEntityManagerFactory
.- Returns:
EntityManagerFactory
.
-
getEntityManager
jakarta.persistence.EntityManager getEntityManager() throws jakarta.persistence.PersistenceExceptionReturnsEntityManager
for persistence operations.- Returns:
EntityManager
for persistence operations.- Throws:
jakarta.persistence.PersistenceException
- if unable to acquireEntityManager
.
-
returnEntityManager
void returnEntityManager(jakarta.persistence.EntityManager em) ClosesEntityManager
.- Parameters:
em
-EntityManager
which should be closed.
-
getTransaction
Returns started transaction.- Parameters:
em
-EntityManager
needed if joining to existing transaction or starting transaction locally.- Returns:
Object
Already started transaction for persistence operations.- Throws:
Exception
- if unable to acquire or open transaction.
-
commitTransaction
Commits specified transaction.- Parameters:
tx
-Object
transaction to be commited.- Throws:
Exception
- occured while committing transaction.
-
rollbackTransaction
Rolls back specified transaction.- Parameters:
tx
-Object
transaction to be rolled back.
-