I have used this tutorial them same way in my application: http://www.benmccann.com/hibernate-with-jpa-annotations-and-guice/
My app is JAX-RS web service which will
If it says that the transaction is already open, that means that it was open by another process and not closed ...
I suggest to use @Transactionl instead of Writing :
em.getTransaction().begin();
and
em.getTransaction().commit();
em.close();
That will manage the things for you ...
so for you it will be this way :
@Transactionl
@POST
@Path("/{id}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public void saveItem(){
entityManager.persist(new Item());
}
Hope that's help