• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hibernate delete

 
harikrishna kolli
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to delete older records, hql looks good but the entities are not getting deleted. When i check the database they are still there. Any help is appreciated

session.delete( cmdy );
session.flush();// not required
tx.commit();
 
Mahesh Gurav
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
entities are not getting deleted. When i check the database they are still there

You are commiting transaction by tx.commit(); but to check whether your transaction got commited or rolled back,Use tx.wasCommitted()& tx.wasRolleBack() which returns boolean status whether your transaction commited or rolledBack.
Further entity you want to delete is involved in cascad relationship with other object??if so it is getting resaved.If it is collection you will get documentation on net easily on this issue.
 
harikrishna kolli
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I fixed it
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic