I can't get the real-data on my page after update ,the data is old.but the database is updated ,I can see on mysql command line.
sometimes I refresh the page the data is new,and refresh again the data is old,it's mutative,strange,strange..
hiberante 3.1
mysql 4.0.20a-nt
my hibernate.cfg.xml:
Code:
<hibernate-configuration>
<session-factory>
<property name="connection.username">root</property>
<property name="connection.url">
jdbc:mysql://localhost:3306/hzsos?useUnicode=true&characterEncoding=UTF-8
</property>
<property name="dialect">
org.hibernate.dialect.MySQLDialect
</property>
<property name="myeclipse.connection.profile">mysql</property>
<property name="connection.password"></property>
<property name="connection.driver_class">
com.mysql.jdbc.Driver
</property>
<property name="show_sql">true</property>
<mapping resource="com/hzsos/common/pojo/CustomList.hbm.xml" />
<mapping resource="com/hzsos/common/pojo/CustomListItem.hbm.xml" />
<mapping resource="com/hzsos/common/pojo/Business.hbm.xml" />
</session-factory>
</hibernate-configuration>
udpate code:
Code:
public void updateBusiness(BusinessForm form) {
Transaction trans = null;
try{
Business business = businessDAO.findById(form.getId());
business.setArea(form.getArea());
business.setCompany(form.getCompany());
trans = session.beginTransaction();
businessDAO.update(business);
session.flush();
trans.commit();
}catch(RuntimeException e){
trans.rollback();
}
}