You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Fernando Padilla <fe...@alum.mit.edu> on 2008/11/27 01:25:15 UTC

issues with closing/opening entity manager (slices)

So i got unique queries working with slices (hoorah), look at the 
appropriate bug (maybe OPENJPA-793) for the patch.

But now I hit this really nasty bug, that I can't create new entity 
managers after I close an old one..  even though the same code works 
with normal openjpa (non-slice).  So the first web request works 
perfectly, but the anything after that fails, hard.

https://issues.apache.org/jira/browse/OPENJPA-794

Please help!! :)

---------------

So, for each of my web requests I open an entitymanager at the begining, 
and close it at the end, something like this:

EntityManager pm = pmf.createEntityManager();
try {
  chain.filter(...);
}
finally {
  pm.close();
}


And this works perfectly without slices.  But when I turn on slices, 
this fails.  The first request works fine, but the second requests 
complains that the EntityManager has already been closed.  So it seems 
to be caching the EntityManager from the previous request...  can 
someone please help me figure out how to fix this??