br.gov.frameworkdemoiselle.internal.producer
Class EntityManagerProducer
java.lang.Object
br.gov.frameworkdemoiselle.internal.producer.EntityManagerProducer
- All Implemented Interfaces:
- Serializable
@RequestScoped
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.
TODO allow users to define EntityManager's scope using demoiselle.properties
- See Also:
- Serialized Form
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EntityManagerProducer
public EntityManagerProducer()
create
@Default
@Produces
public javax.persistence.EntityManager create(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.
getEntityManager
public javax.persistence.EntityManager getEntityManager(String persistenceUnit)
init
@PostConstruct
public void init()
close
@PreDestroy
public void close()
getCache
public Map<String,javax.persistence.EntityManager> getCache()
Copyright © 2012 SERPRO - Serviço Federal de Processamento de Dados. All Rights Reserved.