Originally posted by Bruno Frascino:
Hi Mark,
I retrieved this entity A from database so it means it is ATTACHED, in other words, it is being managed by persistence context.
So I thought detaching it, using:
em.clear() - Clear the persistence context, causing all managed entities to become detached.
But this entity manager method detaches ALL entities... I am just wondering, could I detach only one?
Thanks again!
Is it truly attached. I thought you showed the Entity into a screen, when you do this and allow a user to change the data, do you still have the Session open? I would also assume you have an n-tier architecture where your UI and Hibernate code is not on the same machine, so when you send the Object down to the client, what the client has and what it sends back is no longer attached, it is a detached object.
I am just trying to get the whole scenario in perspective.
Yeah, unfortunately JPA doesn't have an evict method like Hibernate's Session has.
Mark