title: Hibernate: evict() a persistent object while storing its changes
body: <p>I have a persistent hibernate object I obtained using <code>session.save(object)</code></p>
  
  <p>I changed it since.</p>
  
  <p>I want to execute <code>session.evict(object)</code> to save memory, as I am done with the object.</p>
  
  <p>The documentation to <code>evict()</code> <a href="http://ajava.org/online/hibernate3api/org/hibernate/Session.html#evict(java.lang.Object)">here</a> states that changes to the object will not be persisted. In other words - evict will cause me to lose changes I did to the object.</p>
  
  <p>I could call <code>session.flush()</code> but that would flush all changes.</p>
  
  <p>How can I persist changes made to a single persistent object before eviction?</p>