title: OptimisticLockException in select query
body: <p>Got an OptimisticLockException in select query</p>
  
  <blockquote>
    <p>javax.persistence.OptimisticLockException     at
    org.hibernate.ejb.AbstractEntityManagerImpl.wrapStaleStateException(AbstractEntityManagerImpl.java:1415)
    [hibernate3.jar:3.6.10.Final]     at
    org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1336)
    [hibernate3.jar:3.6.10.Final]     at
    org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1317)
    [hibernate3.jar:3.6.10.Final]     at
    org.hibernate.ejb.QueryImpl.<strong><em>getResultList</em></strong>(QueryImpl.java:255)
    [hibernate3.jar:3.6.10.Final]</p>
  </blockquote>
  
  <p>The query is a simple select query involving multiple entities and where clause like</p>
  
  <blockquote>
    <p>select distinct a.id ,b.type ... from table1 a ,table2 b ,table3
    c...where b.id=a and c.id in...</p>
  </blockquote>
  
  <p>It is known that OptimisticLockException occurs when we try to update a dirty entity ,but how can a select query cause this exception.Is there any possibilty or is this a bug ?</p>