title: How to Prevent save to Database in Hibernate on transaction commit?
body: <p>Giving some context - I am migrating my database to some other platform on which Hibernate queries are not supported. Since there are a lot of places where Hibernate concepts are used, I plan to change <code>load()</code>, <code>save()</code>, and <code>delete()</code> functions at the DAO layer to work on the new database rather than changing at the service layer. But, one problem is when Hibernate saves itself when a transaction is committed. How can I avoid that?</p>
  
  <p>When a transaction is committed in Hibernate the persistent entities in the session are saved to the database. Since I am using the <code>@Transactional</code> annotation of Spring I don't have control over this. My requirement is that I want to prevent objects from being saving into the database by Hibernate and save objects myself using the DAO inside the class using the <code>@Transactional</code> annotation. Also, I read about stateless sessions of Hibernate, so would it be a good idea to use them as I am not saving anything to the session? I read about this but couldn't find a concrete solution to this. Can some Hibernate + Spring expert help in this regard?</p>