This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Hibernate Session.evict() with pesistent childs Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply Bookmark "Hibernate Session.evict() with pesistent childs" Watch "Hibernate Session.evict() with pesistent childs" New topic
Author

Hibernate Session.evict() with pesistent childs

Hans-J�rgen W�lchow
Greenhorn

Joined: Oct 24, 2007
Posts: 2
At first: Hi @all, because i'm new here.
Now my question:
I have some objects in a hibernate-session. This objects can be manipulated by several threads (never competitively).
Somtimes i have to change objects whithout saving directly. But if a other thread saves an other object the session will be flushed and all objects are saved.
I know, i can evict the object after loading, but if i need to access a persistent child of an evicted object an error is thrown ("No session...").
If i want to evict an object with persitent members i have to evict ALL childs in a recursion or is there a other way to do so?
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17228
    
    1

I would have a seperate Session per thread, rather than sharing one where there can be conflicts.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Hans-J�rgen W�lchow
Greenhorn

Joined: Oct 24, 2007
Posts: 2
Thanks for reply, Mark
but i think, the problem will not be fixed by using seperate sessions. Per example, if in UI editors are open for different objects and you are changing more than one object: you would like to save one, and all other are saved too. Because i have to use the caching its not a option to use seperate sessions for every object.
[ October 25, 2007: Message edited by: Hans-J�rgen W�lchow ]
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17228
    
    1

"UI Editors" Um, that would be on the client side. So I think you need to post your architecture. Because from that, it sounds like a two-tier system.

What are you trying to accomplish in terms of how the user uses the system?

Mark
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate Session.evict() with pesistent childs
 
Similar Threads
is save reqiured for presistent objects? (can i make it required)
2nd Level cache eviction not cascading
is it possible to evict cascade a cleared collection?
Maintaining create/delete/update actions on child records in Hibernate across different sessions
Clearing L2 Cache using hibernate