Interface JPAEntityManagerProviderFactory
@ProviderType
public interface JPAEntityManagerProviderFactory
A factory for creating JPAEntityManagerProvider instances
This factory can be used if the JPAEntityManagerProvider
should not
be a public service, for example to protect a username/password.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The property used to set the maximum amount of time that connections in the pool should remain openstatic final String
The property used to determine whether connection pooling is enabled for this resource providerstatic final String
The property used to set the maximum amount of time that the pool should wait for a connectionstatic final String
The property used to set the maximum amount of time that connections in the pool should remain idle before being closedstatic final String
The property used to determine whether local enlistment is enabled for this resource providerstatic final String
The property used to set the maximum number of connections that should be held in the poolstatic final String
The property used to set the minimum number of connections that should be held in the poolstatic final String
The property used to set the recovery identifier that should be used by this resourcestatic final String
The property used to indicate that database connections will be automatically enlisted in ongoing transactions without intervention from the JPA resource providerstatic final String
The property used to provide aJDBCConnectionProvider
to the resource provider.static final String
The property used to determine whether XA enlistment is enabled for this resource providerstatic final String
The property used to determine whether XA recovery is enabled for this resource provider -
Method Summary
Modifier and TypeMethodDescriptiongetProviderFor
(javax.persistence.EntityManagerFactory emf, Map<String, Object> resourceProviderProperties) Create a privateJPAEntityManagerProvider
using an existingEntityManagerFactory
.getProviderFor
(EntityManagerFactoryBuilder emfb, Map<String, Object> jpaProperties, Map<String, Object> resourceProviderProperties) Create a privateJPAEntityManagerProvider
using anEntityManagerFactoryBuilder
.void
releaseProvider
(JPAEntityManagerProvider provider) Release aJPAEntityManagerProvider
instance that has been created by this factory.
-
Field Details
-
XA_ENLISTMENT_ENABLED
The property used to determine whether XA enlistment is enabled for this resource provider- See Also:
-
LOCAL_ENLISTMENT_ENABLED
The property used to determine whether local enlistment is enabled for this resource provider- See Also:
-
XA_RECOVERY_ENABLED
The property used to determine whether XA recovery is enabled for this resource provider- See Also:
-
CONNECTION_POOLING_ENABLED
The property used to determine whether connection pooling is enabled for this resource provider- See Also:
-
CONNECTION_TIMEOUT
The property used to set the maximum amount of time that the pool should wait for a connection- See Also:
-
IDLE_TIMEOUT
The property used to set the maximum amount of time that connections in the pool should remain idle before being closed- See Also:
-
CONNECTION_LIFETIME
The property used to set the maximum amount of time that connections in the pool should remain open- See Also:
-
MIN_CONNECTIONS
The property used to set the minimum number of connections that should be held in the pool- See Also:
-
MAX_CONNECTIONS
The property used to set the maximum number of connections that should be held in the pool- See Also:
-
TRANSACTIONAL_DB_CONNECTION
The property used to provide aJDBCConnectionProvider
to the resource provider. This will be converted into a DataSource by the factory, and passed to theEntityManagerFactoryBuilder
using the javax.persistence.jtaDataSource property- See Also:
-
PRE_ENLISTED_DB_CONNECTION
The property used to indicate that database connections will be automatically enlisted in ongoing transactions without intervention from the JPA resource provider- See Also:
-
OSGI_RECOVERY_IDENTIFIER
The property used to set the recovery identifier that should be used by this resource- See Also:
-
-
Method Details
-
getProviderFor
JPAEntityManagerProvider getProviderFor(EntityManagerFactoryBuilder emfb, Map<String, Object> jpaProperties, Map<String, Object> resourceProviderProperties) Create a privateJPAEntityManagerProvider
using anEntityManagerFactoryBuilder
. This call may fail with aTransactionException
if the supplied configuration is invalid. Examples of invalid configuration include:- The properties request XA enlistment, but the provider implementation only supports local enlistment
- The properties attempt to set a recovery alias, but the provider does not support recovery.
If XA transactions are used then this factory will provide configuration to ensure that the JPA Provider can participate correctly in ongoing transactions.
- Parameters:
emfb
-jpaProperties
- The properties to pass to theEntityManagerFactoryBuilder
in order to create the underlyingEntityManagerFactory
andEntityManager
instancesresourceProviderProperties
- Configuration properties to pass to the JPA Resource Provider runtime- Returns:
- A
JPAEntityManagerProvider
that can be used in transactions
-
getProviderFor
JPAEntityManagerProvider getProviderFor(javax.persistence.EntityManagerFactory emf, Map<String, Object> resourceProviderProperties) Create a privateJPAEntityManagerProvider
using an existingEntityManagerFactory
. This call may fail with aTransactionException
if the supplied configuration is invalid. Examples of invalid configuration include:- The properties request XA enlistment, but the provider implementation only supports local enlistment
- The properties attempt to set a recovery alias, but the provider does not support recovery.
When using this method the client is responsible for all configuration of the
EntityManagerFactory
. This includes setting any relevant integration plugins for ensuring that the JPA provider can participate in the ongoing transaction context.- Parameters:
emf
-resourceProviderProperties
- Configuration properties to pass to the JDBC Resource Provider runtime- Returns:
- A
JPAEntityManagerProvider
that can be used in transactions
-
releaseProvider
Release aJPAEntityManagerProvider
instance that has been created by this factory. Released instances are eligible to be shut down and have any remaining open connections closed.Note that all
JPAEntityManagerProvider
instances created by this factory service are implicitly released when the factory service is released by this bundle.- Parameters:
provider
-- Throws:
IllegalArgumentException
- if the supplied resource was not created by this factory service instance.
-