Hibernate delete not working -
Hibernate delete not working -
while debugging server side code, came realize delete row not working. have copied code insert , replaced session.saveorupdate session.delete. right way delete object? doing wrong here ?
i not getting exceptions.
public void delete(object datastore) throws didnotsaverequestsomerandomerror { transaction txd; session session; session = currentsession(); //get first , fallback begin. if (session.gettransaction() != null && session.gettransaction().isactive()) { txd = session.gettransaction(); } else { txd = session.begintransaction(); } seek { session.delete(datastore); } grab (mappingexception e) { e.printstacktrace() ; } seek { txd.commit(); while (!txd.wascommitted()) ; } grab (constraintviolationexception e) { log.error("unable delete info " + datastore.getclass().tostring()); txd.rollback(); throw new didnotsaverequestsomerandomerror(datastore, feedbackmanager); } grab (transactionexception e) { log.debug("txd state isactive" + txd.isactive() + " txd participating" + txd.isparticipating()); log.debug(e); txd.rollback(); } { session.flush(); txd = null; session.close(); } }
edit :
i tried putting session.flush after session.delete, did not work.
hibernate delete-row
Comments
Post a Comment