org.ow2.easybeans.persistence.api
Interface EZBPersistenceUnitManager


public interface EZBPersistenceUnitManager

Allows to get persistence units and allow to return EntityManager or EntityManagerFactory.

Author:
Florent Benoit

Method Summary
 javax.persistence.EntityManager getEntityManager(String unitName, javax.persistence.PersistenceContextType type)
          Gets an entity manager for the given unit name and the extra attributes.
 javax.persistence.EntityManagerFactory getEntityManagerFactory(String unitName)
          Gets an entity manager factory for the given unit name.
 Map<String,String> getProperty(String name)
          Gets property values in each persistence unit info
 void merge(EZBPersistenceUnitManager otherPersistenceUnitManager)
          Merge the persistence context of a an other persistent unit manager in this one.
 void setProperty(String name, String value)
          Set a property in persistence unit.
 void setProperty(String name, String value, String persistenceUnitName)
          Set a property in persistence unit.
 

Method Detail

getEntityManager

javax.persistence.EntityManager getEntityManager(String unitName,
                                                 javax.persistence.PersistenceContextType type)
Gets an entity manager for the given unit name and the extra attributes.

Parameters:
unitName - the name of the persistence unit
type - the type of the persistence context
Returns:
entity manager corresponding to arguments

getEntityManagerFactory

javax.persistence.EntityManagerFactory getEntityManagerFactory(String unitName)
Gets an entity manager factory for the given unit name.

Parameters:
unitName - the name of the persistence unit
Returns:
entity manager factory.

merge

void merge(EZBPersistenceUnitManager otherPersistenceUnitManager)
Merge the persistence context of a an other persistent unit manager in this one. Note that as specified in chapter 6.2.2 (persistence unit scope), an EAR level component level will only be seen by a subcomponent if it was not redefined. In our case : don't merge the given unit-name if the current manager defines this unit-name.

Parameters:
otherPersistenceUnitManager - the other persistence unit manager that will be merged into this one.

setProperty

void setProperty(String name,
                 String value)
Set a property in persistence unit. If property does not exists, add it.

Parameters:
name - property name
value - property value

setProperty

void setProperty(String name,
                 String value,
                 String persistenceUnitName)
Set a property in persistence unit. If property does not exists, add it.

Parameters:
name - property name
value - property value
persistenceUnitName - specific persistenceUnitName. If null, set the property in all persistence units

getProperty

Map<String,String> getProperty(String name)
Gets property values in each persistence unit info

Parameters:
name - property name
Returns:
property values in each persistence unit info


Copyright © 2006-2012 OW2 Consortium. All Rights Reserved.