休眠删除错误:批量更新返回意外的行计数
我在下面写了这个方法,假设从数据库中删除成员记录。但是当我在我的servlet中使用它时,它会返回一个错误。
会员道班
public static void deleteMember(Member member) {
Session hibernateSession = HibernateUtil.getSessionFactory().getCurrentSession();
Transaction tx = hibernateSession.beginTransaction();
hibernateSession.delete(member);
tx.commit();
}
控制器部件
if(delete != null) {
HttpSession httpSession = request.getSession();
Member member = (Member) httpSession.getAttribute("member");
MemberDao.deleteMember(member);
nextPage = "ledenlijst.jsp";
}
HTTP 状态 500
org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
有时,当我尝试多次执行页面时,它甚至会抛出此错误。
org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
有谁知道究竟是什么导致了这些错误?