hibernate操作数据库问题,求高手指点
//删除数据
public int delete(int id) {
int flag=0;
System.out.println(id);
Purview purview = (Purview)this.getHibernateTemplate().get(Purview.class, id);
if(purview!=null){
this.getHibernateTemplate().delete(purview);
Manager manager = (Manager)this.getHibernateTemplate().get(Manager.class, id);
if(manager!=null){
this.getHibernateTemplate().delete(manager);
flag = 1;
}
}else{
Manager manager = (Manager)this.getHibernateTemplate().get(Manager.class, id);
if(manager!=null){
this.getHibernateTemplate().delete(manager);
flag = 1;
}
}
return flag;
}
调用该方法时,控制台打出了delete语句,没有异常,页面的数据被删除了,但是数据库的数据还是存在,请问是什么原因??求高手指点
------解决方案--------------------
仔细看了遍openSessionInView应该是
<filter>
<filter-name>openSessionInView</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
<init-param>
<param-name>sessionFactoryBeanName</param-name>
<param-value>你的sessionFactory</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>openSessionInView</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>