jersey « Test « JPA Q&A

1. OpenJPA, Jersey, JUnit: Using a different persistence unit for my unit tests?

I'm building an application using OpenJPA 2.0.0, Jersey 1.3, and JUnit 4.8.1. I've set it up so I have two different persistence units defined in my persistence.xml: "default" and "unittest." Default ...

2. How and who should inject PersistenceContext when running tests through Jersey/Grizzly?

I have this class (mix of JAX-RS/Jersey and JPA/Hibernate):

public class Factory {
  @PersistenceContext(unitName = "abc")
  EntityManager em;
  public String read(@PathParam("id") int i) {