title: Trouble with hibernate optimistic lock and collections
body: <p>I have a trouble in using optimistic locking. I have a persistent object, with a version number. I want this version number to be increased only when my persistent object is 'really' updated, meaning when one or more fields have been modified or when a collection mapped in my entity with a <code>@ManyToOne</code> or <code>@OneToMany</code> annotation is modified in the database.
  What happens is that the version is increased only when a field contained directly in my entity has changed, and <strong>not when a collection has changed</strong>.</p>
  
  <p>Note : I put <strong>select-before-update</strong> in my Entity annotation. Don't know if it might changed the behaviour of the versioning on the collections!
  I also have a field which should not influence the version in my entity, on which I put the <code>@OptimisticLock(exclude=true)</code> annotation.</p>
  
  <p>Does anyone know how I may try to make my versioning work? According to what I've read on several forums, the version number should be automatically increased when a collection changed. Why wouldn't it be the case in my case? Any idea?</p>