This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Query after JPA collective update not getting updates Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Query after JPA collective update not getting updates" Watch "Query after JPA collective update not getting updates" New topic
Author

Query after JPA collective update not getting updates

Oliver Chua
Greenhorn

Joined: Feb 27, 2004
Posts: 29
Hi All,

I am using JPA on JSE.
I've added two records in the table, updated both records collectively,
and then retrieved both records to check they've been updated.

I've tried debugging, and the database is updated after the commit,
but the select doesn't return the newer versions.
If I get a new entity manager and use it to query, it passes.

Is there an explanation for this behavior
and is there a fix or a workaround without getting a new entity manager?

Thanks







Braden Walker
Greenhorn

Joined: Apr 10, 2014
Posts: 1
I would suggest trying an EntityManager.flush() after executing your update, and before doing an EntityManager.getTransaction().commit() - I had a very similar problem, and this worked for me.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Query after JPA collective update not getting updates
 
Similar Threads
persistence.xml file for MS SQL Server 2000
Please help me need urgent help on JPA connection
Simple JPA Program using Eclipselink 1.1 in Eclipse
javax.persistence.PersistenceException
Application-managed persistence context in EJB