Top Description Fields Methods
org.osgi.service.jpa

public Interface EntityManagerFactoryBuilder

Annotations
@ProviderType
Imports
java.util.Map, javax.persistence.EntityManagerFactory, javax.persistence.spi.PersistenceProvider, org.osgi.annotation.versioning.ProviderType, org.osgi.framework.Bundle

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

Modifier and TypeField and Description
public static final String
JPA_CAPABILITY_NAME

The name of the JPA extender capability.

public static final String
JPA_SPECIFICATION_VERSION

The version of the extender capability for the JPA Service specification

public static final String
JPA_UNIT_NAME

The name of the persistence unit.

public static final String
JPA_UNIT_PROVIDER

The class name of the provider that registered the service and implements the JPA javax.persistence.PersistenceProvider interface.

public static final String
JPA_UNIT_VERSION

The version of the persistence unit bundle.

Method Summary

Modifier and TypeMethod and Description
public EntityManagerFactory

Returns:

An EntityManagerFactory for the persistence unit associated with this service. Must not be null.
createEntityManagerFactory
(Map<String, Object>
Properties to be used, in addition to those in the persistence descriptor, for configuring the EntityManagerFactory for the persistence unit.
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.

public Bundle

Returns:

The Bundle which provides the PersistenceProvider implementation used by this EntityManagerFactoryBuilder.
getPersistenceProviderBundle
()

This method returns the Bundle which provides the PersistenceProvider implementation that is used by this EntityManagerFactoryBuilder.

public String

Returns:

the name of the PersistenceProvider implementation
getPersistenceProviderName
()

This method returns the name of the PersistenceProvider implementation that is used by this EntityManagerFactoryBuilder.

Field Detail

JPA_CAPABILITY_NAMEback to summary
public static final String JPA_CAPABILITY_NAME

The name of the JPA extender capability.

Since
1.1
JPA_SPECIFICATION_VERSIONback to summary
public static final String JPA_SPECIFICATION_VERSION

The version of the extender capability for the JPA Service specification

Since
1.1
JPA_UNIT_NAMEback to summary
public static final String JPA_UNIT_NAME

The name of the persistence unit.

JPA_UNIT_PROVIDERback to summary
public static final String JPA_UNIT_PROVIDER

The class name of the provider that registered the service and implements the JPA javax.persistence.PersistenceProvider interface.

JPA_UNIT_VERSIONback to summary
public static final String JPA_UNIT_VERSION

The version of the persistence unit bundle.

Method Detail

createEntityManagerFactoryback to summary
public EntityManagerFactory createEntityManagerFactory(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.

Parameters
props:Map<String, Object>

Properties to be used, in addition to those in the persistence descriptor, for configuring the EntityManagerFactory for the persistence unit.

Returns:EntityManagerFactory

An EntityManagerFactory for the persistence unit associated with this service. Must not be null.

getPersistenceProviderBundleback to summary
public Bundle getPersistenceProviderBundle()

This method returns the Bundle which provides the PersistenceProvider implementation that is used by this EntityManagerFactoryBuilder.

If the PersistenceProvider is 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 the PersistenceProvider implementation class.

Returns:Bundle

The Bundle which provides the PersistenceProvider implementation used by this EntityManagerFactoryBuilder.

Since
1.1
getPersistenceProviderNameback to summary
public String getPersistenceProviderName()

This method returns the name of the PersistenceProvider implementation that is used by this EntityManagerFactoryBuilder. The returned value will be the same as the value of the JPA_UNIT_PROVIDER service property.

Returns:String

the name of the PersistenceProvider implementation

Since
1.1