I would like to know when we use cascade attribute. I saw setting cascade=true within set property attribute while doing many-one, one-many association hibernate examples. any ideas, suggestions, sample code, resources, links highly appreciated.thanks in advance
cascade is used when an item in table A relies on an item in Table B (ie has a foreign key reference) and the data in table A has no meaning if the item in Table B is deleted.
eg A Person has an Address, the Address contains the ID of the Person. If a Person is deleted then the delete operation should cascade so that it deletes the Address to.
Operations should not always cascade but you should consider the impact of deletes (and other operations) on foreign key constraints.