Inject « EntityManager « JPA Q&A





1. Why EntityManager is not injected?    stackoverflow.com

This is the class I'm trying to test:

@Stateless
public class Finder {
  @PersistenceContext(unitName = "abc")
  EntityManager em;
  public String read(int i) {
    return this.em.find(Employee.class, i).getName();
  ...

2. Question about the effect of setFlushMode on an injected, container managed EntityManager    stackoverflow.com

I am using EJB 3.1 and I have a Stateless Session Bean that I am injecting an EntityManager into. One of the EJB's methods calls entityManager.setFlushMode(FlushModeType.COMMIT). Two questions: 1) I assume that ...