Difference between Hibernate evict() and clear()

What is the difference between calling evict() and clear on a Hibernate session? As far as I understand both detach objects from the session?
graham on 25-04-2013 08:23
The method evict() removes a single object from the session, clear() removes all objects from the session. So calling clear() is like calling evict() on every single object associated with the session.
graham on 25-04-2013 08:26

Post an answer

Do you have a solution to this problem, or want to comment on it? Other users will appreciate your help!
Your answer or comment:
Show formatting hints
HTML is disallowed, but in your text you can use the following markup
  • [code][/code] for a block of code
  • [tt][/tt] for inline code
  • [link]link href|link anchor[/link] for links
  • [b][/b] for bold text
+ Ask a question
If you have a technical question related to programming and computers, ask it here. Other users will help you solve it!
Unanswered questions
Share your knowledge by helping others solve their problems