i want to delete a row and cascade all foreign keys in hibernate i am new to hibernate and i want to know if there's a method to delete an entity>> session.delete(); like the session.save and session.update methods in hibernate?
+1
A:
Yes, hibernate's Session
has delete(entity)
method.
If you want to cascade dependencies, you'd have to set @*ToMany(cascade=CascadeType.DELETE)
Bozho
2010-06-09 21:41:41
where to set this annotation on the primary key or the foreign key ?
2010-06-09 21:44:57
not on the primary key. I wouldn't call it "on the foreign key", but yes.
Bozho
2010-06-09 21:45:36