br.gov.frameworkdemoiselle.internal.producer
Class EntityManagerProducer

java.lang.Object
  extended by br.gov.frameworkdemoiselle.internal.producer.EntityManagerProducer
All Implemented Interfaces:
Serializable

@ApplicationScoped
public class EntityManagerProducer
extends Object
implements Serializable

Factory class responsible to produces instances of EntityManager. Produces instances based on informations defined in persistence.xml, demoiselle.properties or @PersistenceUnit annotation.

See Also:
Serialized Form

Constructor Summary
EntityManagerProducer()
           
 
Method Summary
protected  javax.persistence.EntityManager createDefault(javax.enterprise.inject.spi.InjectionPoint ip, EntityManagerConfig config)
           Default EntityManager factory.
protected  javax.persistence.EntityManager createNamed(javax.enterprise.inject.spi.InjectionPoint ip, EntityManagerConfig config)
           Factory that reads the AmbiguousQualifier qualifier and creates an entity manager with a matching persistence unit name.
 Map<String,javax.persistence.EntityManager> getCache()
           
 javax.persistence.EntityManager getEntityManager(String persistenceUnit)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EntityManagerProducer

public EntityManagerProducer()
Method Detail

createDefault

@Default
@Produces
protected javax.persistence.EntityManager createDefault(javax.enterprise.inject.spi.InjectionPoint ip,
                                                                         EntityManagerConfig config)

Default EntityManager factory. Tries two strategies to produces EntityManager instances.

  • The first one is based on informations available on demoiselle properties file ("frameworkdemoiselle.persistence.unit.name" key).
  • The second one is based on persistence.xml file. If exists only one Persistence Unit defined, this one is used.
  • Parameters:
    config - Suplies informations about EntityManager defined in properties file.
    Returns:
    Produced EntityManager.

    createNamed

    @Produces
    protected javax.persistence.EntityManager createNamed(javax.enterprise.inject.spi.InjectionPoint ip,
                                                                   EntityManagerConfig config)

    Factory that reads the AmbiguousQualifier qualifier and creates an entity manager with a matching persistence unit name.

    Parameters:
    config - Suplies informations about EntityManager defined in properties file.
    Returns:
    Produced EntityManager.

    getEntityManager

    public javax.persistence.EntityManager getEntityManager(String persistenceUnit)

    getCache

    public Map<String,javax.persistence.EntityManager> getCache()


    Copyright © 2013 SERPRO - Serviço Federal de Processamento de Dados. All Rights Reserved.