When I try to delete an object using HQL, I use hiberate's session.CreateQuery().executeUpdate()
and it returns 1 item is deleted. However, in database, nothing has been deleted. After executeUpdate
, I also did flush.
Could anyone give me some suggestion about what's wrong here?
You haven't committed an enclosing transaction. You need something like:
tx = session.beginTransaction()
session.createQuery().executeUpdate("...")
tx.commit()