データベースからメンバーレコードを削除すると仮定して、このメソッドを以下に記述しました。しかし、サーブレットで使用すると、エラーが返されます。Hibernate Delete Error:予期しない行番号
MemberDaoクラス
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
これらのエラーの原因を正確に知っている人はいますか?
可能な複製:http://stackoverflow.com/questions/3853106/org-hibernate-stalestateexception-batch-update-returned-unexpected-row-count-fr –
同じ「メンバー」を2回削除しようとしていますか? –