Want to delete the records by the loginname. a is the value returns the number of rows which will be deleted. If I used session.flush(), the record is deleted. However, it returned the errors. If I don't use session.flush(), the records still here.
Hibernate version:
2.1.6
Mapping documents:
Code between sessionFactory.openSession() and session.close():
int a =
session.delete("from com.company.SubscribeHobby SubscribeHobby where SubscribeHobby.loginname = ?",loginname, new StringType());
session.flush();
Full stack trace of any exception that occurs:
javax.servlet.ServletException: net.sf.hibernate.HibernateException: SQL insert, update or delete failed (row not found)
at org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:516)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:423)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1158)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
.
.
.
Name and version of the database you are using:
MySQL 4.0
Debug level Hibernate log excerpt:
If session.flush() is called, it will has SQL delete statement in tomcat log.
Otherwise, no SQL delete statement.
|