tags:

views:

41

answers:

1

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
where to set this annotation on the primary key or the foreign key ?
not on the primary key. I wouldn't call it "on the foreign key", but yes.
Bozho