Hibernate version: 2.1.8
Mapping documents:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate//Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="com.flysafe.business.Product" table="PRODUCTS">
<id name="id">
<generator class="native"/>
</id>
<property name="description"/>
<property name="price"/>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():Code:
Session session = productDao.getSessionFactory().openSession();
Transaction tx = session.beginTransaction();
products = productDao.findAll();
ListIterator i = products.listIterator();
while (i.hasNext())
{
Product product = (Product) i.next();
product.increasePrice(increase);
//productDao.saveProduct(product);
}
tx.commit();
session.close();
Full stack trace of any exception that occurs: No exception occured.
Name and version of the database you are using: HSQLDB
I'm using hibernate with spring. I was expecting that the above code would update the database because of the "Automatic Dirty Checking" features of hibernate. But it doesn't.
If I uncomment the line productDao.saveProduct(product) which updates the database explicity then things work.
What additional thing must I do to get "Automatic Dirty Checking" to work in this case?