I am using JBoss3.2.6 with Hibernate 2.1.6.
Everything is OK,But when I want to set a field in my table to null, it fails to do so.
My code goes like:
Code:
Session session =HibernateContext.getSession("java:/hibernate/MySessionFactory");
List list = null;
try {
list = session.find("from EseExperimentUser as eeu where eeu.UserId = ?",userId,Hibernate.INTEGER);
Iterator iter = list.iterator();
while(iter.hasNext()){
MyObject = (MyObject)iter.next();
MyObject.setFiled1(null); //Filed1 is a filed that allows null value
session.update(MyObject);
}
} catch (HibernateException e) {
e.printStackTrace();
}
After running this program, there is no exception; However the field1 in DB is remains no change. Why?
Thanks for your help!