This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Query after JPA collective update not getting updates

 
Oliver Chua
Greenhorn
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic