title: Hibernate - How to persist a new item in a Collection without loading the entire Collection
body: <p>I have a collection in my model that contains a set of 'previous versions' of my root domain object. The previous versions are therefore 'immutable' and we will never want to update them, and only want to add past versions as they arise. Also the 'versioned' domain object is fairly complex and causes heavy database access to retrieve.</p>
  <p>When I have a new version of one of these objects I want to save it with the others without loading the entire set. The Advanced FAQ has some advice on this:</p>
  <blockquote>
  <p>Why does Hibernate always initialize a collection when I only want to add or remove an element?</p>
  <p>Unfortunately the collections API defines method return values that may only be computed by hitting the database. There are three exceptions to this: Hibernate can add to a <code>&lt;bag&gt;</code>, <code>&lt;idbag&gt;</code> or <code>&lt;list&gt;</code> declared with <code>inverse=&quot;true&quot;</code> without initializing the collection; the return value must always be true.</p>
  <p>If you want to avoid extra database traffic (ie. in performance critical code), refactor your model to use only many-to-one associations. This is almost always possible. Then use queries in place of collection access.</p>
  </blockquote>
  <p>I am new to all of this and am not 100% sure on how to refactor your model to use only many-to-one associations. Can anyone please give me an example of point me to a tutorial so that I can learn how this will resolves my issue?</p>