title: Hibernate Cache and autocommit explanation
body: <p>Im having a hard time figuring out why something is happening in my application.
  Using spring and Hibernate and struts2 there is some really strange stuff i noticed during debugging.</p>
  
  <p>I have a user-form, where a user can edit his information. When this form is submitted, the controller's <code>save()</code> method should do some stuff and save the user.</p>
  
  <p>The strange thing is, that before I do anything in the controller, i want to find information about who is doing this change. So i fetch a User-object from the db based on the Id of whoever is submitting the form. But when this user-object is fetched. Then automaticly the user in the form is submitted...
  Im fetching the user like this:</p>
  
  <pre><code>User createdByUser = (User) getHibernateTemplate().find("from User u where u.username=?", username).get(0);
  </code></pre>
  
  <p>So apparantly some mechanism is auto-committing my user.
  Most of the time, my createdByUser is the same user as the submitted user. Could there be that hibernate detects this and somehow tries to synchronize the db?</p>