Package org.osgi.service.jpa
Interface EntityManagerFactoryBuilder
@ProviderType
public interface EntityManagerFactoryBuilder
This service interface offers JPA clients the ability to create instances of
EntityManagerFactory for a given named persistence unit. A service instance
will be created for each named persistence unit and can be filtered by
comparing the value of the osgi.unit.name property containing the persistence
unit name.
This service is used specifically when the caller wants to pass in
factory-scoped properties as arguments. If no properties are being used in
the creation of the EntityManagerFactory then the basic EntityManagerFactory
service should be used.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe name of the JPA extender capability.static final StringThe version of the extender capability for the JPA Service specificationstatic final StringThe name of the persistence unit.static final StringThe class name of the provider that registered the service and implements the JPA javax.persistence.PersistenceProvider interface.static final StringThe version of the persistence unit bundle. -
Method Summary
Modifier and TypeMethodDescriptionjavax.persistence.EntityManagerFactorycreateEntityManagerFactory(Map<String, Object> props) Return an EntityManagerFactory instance configured according to the properties defined in the corresponding persistence descriptor, as well as the properties passed into the method.This method returns theBundlewhich provides thePersistenceProviderimplementation that is used by thisEntityManagerFactoryBuilder.This method returns the name of thePersistenceProviderimplementation that is used by thisEntityManagerFactoryBuilder.
-
Field Details
-
JPA_UNIT_NAME
The name of the persistence unit.- See Also:
-
JPA_UNIT_VERSION
The version of the persistence unit bundle.- See Also:
-
JPA_UNIT_PROVIDER
The class name of the provider that registered the service and implements the JPA javax.persistence.PersistenceProvider interface.- See Also:
-
JPA_CAPABILITY_NAME
The name of the JPA extender capability.- Since:
- 1.1
- See Also:
-
JPA_SPECIFICATION_VERSION
The version of the extender capability for the JPA Service specification- Since:
- 1.1
- See Also:
-
-
Method Details
-
createEntityManagerFactory
Return an EntityManagerFactory instance configured according to the properties defined in the corresponding persistence descriptor, as well as the properties passed into the method.- Parameters:
props- Properties to be used, in addition to those in the persistence descriptor, for configuring the EntityManagerFactory for the persistence unit.- Returns:
- An EntityManagerFactory for the persistence unit associated with this service. Must not be null.
-
getPersistenceProviderName
String getPersistenceProviderName()This method returns the name of thePersistenceProviderimplementation that is used by thisEntityManagerFactoryBuilder. The returned value will be the same as the value of theJPA_UNIT_PROVIDERservice property.- Returns:
- the name of the
PersistenceProviderimplementation - Since:
- 1.1
-
getPersistenceProviderBundle
Bundle getPersistenceProviderBundle()This method returns theBundlewhich provides thePersistenceProviderimplementation that is used by thisEntityManagerFactoryBuilder.If the
PersistenceProvideris provided as an OSGi service then this method must return the bundle which registered the service. Otherwise this method must return the bundle which loaded thePersistenceProviderimplementation class.- Returns:
- The Bundle which provides the
PersistenceProviderimplementation used by thisEntityManagerFactoryBuilder. - Since:
- 1.1
-