title: What is the Hibernate equivalent of JDO makeTransient
body: <p>I am porting my Dao layer from KodoJDO to Hibernate.
  I am keeping my menus in the database and based on a user's entitlements I prune a local copy to display only what the user is allowed to do.</p>
  
  <p>When I did this in KodoJDO I had to make the objest I was pruning transient because I didn't want to write the changes back to the db.</p>
  
  <p>I don't see any equivalent function in Hibernate. Is there one? How do I keep these changes from getting written back to the db. </p>
  
  <p>Here is the prune function.</p>
  
  <pre><code> public void prune(Collection&lt;Entitlement&gt; ents)
   {
    Session session=PersistenceManager.getManager();
    // Rewrite----------------------------------
    //session.makeTransient(this);
  
    for (Iterator&lt;Leaf&gt; iter = leafs.iterator(); iter.hasNext();)
    {
     Leaf l = (Leaf) iter.next();
     if(!l.isAllowed(ents))
     {
      iter.remove();
     }
    }
    for (Iterator&lt;Branch&gt; iter = branches.iterator(); iter.hasNext();)
    {
     Branch b = (Branch) iter.next();
     if(b!= this)
     {
      b.prune(ents);
     }
     if (b.hasNoChildren())
     {
      iter.remove();
     }
    }
   }
  </code></pre>
  
  <p>Comment on answers. I accepted the one that was most complete, but the answers by skaffman and Affe were valuable as well.</p>