Deleting persistent objects in Hibernate by R4R Team

Now in the Hibernate we can delete objects in any order, without risk of foreign key constraint violations. It is still possible to violate a NOT NULL constraint on a foreign key column by deleting objects in the wrong order, if delete the parent, but forget to delete the children.

Session.delete() will remove an object's state from the database. Whenever it can still hold a reference to a deleted object. It is best to think of delete() as making a persistent instance, transient.

session.delete(student);
Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!