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

Hibernate Session.evict() with pesistent childs

 
Hans-J�rgen W�lchow
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would have a seperate Session per thread, rather than sharing one where there can be conflicts.

Mark
 
Hans-J�rgen W�lchow
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!