Weird JpaPersistService Issue

251 views
Skip to first unread message

mgbowman

unread,
Oct 5, 2010, 2:13:28 PM10/5/10
to google-guice
This is a shot in the dark but let me explain what's going on...

I'm using guice + guice-servlet + guice-persist (20100927) in my
current development efforts. Every method in my business logic which
access the EntityManager is annotated with @Transactional. Using the
Eclipse debugger, I can confirm that at the end of every Transaction
the call to JpaPersistService.end() is called which removes the
ThreadLocal EntityManager instance.

It seems that on subsequent requests which are handled by a thread
which had already serviced a previous request, the ThreadLocal returns
a previously created EntityManager (confirmed by the object id in the
Eclipse debugger) which is returning a 'stale' state of the database.

I'm completely at a loss of words on this and I'm going to debug it
more tomorrow. If there's any chance that anybody could give any sort
of insight, it will be greatly appreciated.

I will update with any new info as I uncover it.

Thanks in advanced,
--mgbowman

Note: I'm running on Java 1.6 + Tomcat 6.0.29 under OS X 10.6.4

Dhanji R. Prasanna

unread,
Oct 8, 2010, 7:42:45 PM10/8/10
to google...@googlegroups.com
What is your JPA provider?

Btw how are you checking the object id? If you're looking at its hashcode that wont tell you anything as hashcodes can repeat. Im not familiar with eclipse's debugger. We have tests asserting that entitymanagers should not cross, so I wonder if it is some flushing issue with your JPA provider?

Dhanji.


--
You received this message because you are subscribed to the Google Groups "google-guice" group.
To post to this group, send email to google...@googlegroups.com.
To unsubscribe from this group, send email to google-guice...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-guice?hl=en.


remi....@gmail.com

unread,
Jul 18, 2013, 2:59:42 AM7/18/13
to google...@googlegroups.com
Hello,

I have pushed a fix for this issue on guice-persist and another user would like it to be integrated in 3.1. See comment on issue: http://code.google.com/p/google-guice/issues/detail?id=597#c13.

Could this commit be pulled to MASTER? Here the URL of my commit: http://code.google.com/r/remibantos-guice-persist/source/detail?r=3a9d1012fedd403c2aaddc47701f8ace9eaa3eb8

Patrick Cavanaugh

unread,
Jul 30, 2013, 7:39:02 AM7/30/13
to google...@googlegroups.com
We have been seeing this issue in our application that uses Guice Persist as well. +1 to pulling this change into master so it doesn't affect future guice-persist users.

remi....@gmail.com

unread,
Aug 30, 2013, 11:33:12 AM8/30/13
to google...@googlegroups.com, matthew.g...@gmail.com
Hi,

Any news about review and reintegration of this commit to master?

Thanks

twr

unread,
Sep 27, 2013, 4:15:50 AM9/27/13
to google...@googlegroups.com, matthew.g...@gmail.com
Hi,

any chance fix for the issue mentioned on July 18 will end up in 4.0?
Message has been deleted

Fridolin Jackstadt

unread,
Jun 20, 2014, 8:08:01 AM6/20/14
to google...@googlegroups.com, matthew.g...@gmail.com
+1 for the fix of Remi Bantos
Reply all
Reply to author
Forward
0 new messages