Even simple delete/insert activities hangs in my hibernate session -
i've coded simple delete statement on client class, calling on dao layer delete row hibernate entity named 'person'. however, on debug, after row getting deleted (before commit), transaction hangs. why?
this persondao deletes person id. can seen, i'm committing transaction, flushing session, closing session properly:
public boolean deleteperson(long personid) { boolean issuccessful = false; transaction tx = null; try { session = sessionfactory.opensession(); tx = session.begintransaction(); person p = new person(); object persistentinstance = session.load(person.class, personid); if (persistentinstance != null) { ((person)persistentinstance).getresponses().clear(); ((person)persistentinstance).getownedevents().clear(); session.delete(persistentinstance); } session.gettransaction().commit(); } catch (exception e) { tx.rollback(); issuccessful = false; e.printstacktrace(); } { session.flush(); session.close(); return issuccessful; } } enter code here
Comments
Post a Comment