Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Retrieving clean Entity from EntityManager

 
Chris Miles
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good Afternoon,

I am using Hibernate behing JPA and have the following problem.

My application pulls an entity out using the find operation of the
EntityManager, and then somewhere else in my application I want to pull
the same Entity out again cleanly with the current database state rather
than the dirty version but any time I try I get the same dirty data.

I have tried to detach the dirty version and then fetch the Entity again
but it is still same.

I have also tried the CacheRetrieveMode.BYPASS hint on the fetch in case
it is a caching problem.

How can I fetch a clean instance of my Entity side by side with the dirty
version?

Thanks

Chris

 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!