Inject « Test « JPA Q&A





1. How to inject PersistenceContext during unit testing?    stackoverflow.com

This is my java class:

public class Finder {
  @PersistenceContext(unitName = "abc")
  EntityManager em;
  public boolean exists(int i) {
    return (this.em.find(Employee.class, i) != null);
  }
}
This ...