How to delete objects using Hibernate?

Hi,

How to delete objects using Hibernate? I want to delete an object (record) in table.

Thanks

View Answers

December 24, 2017 at 9:15 PM

Hi,

Hibernate Session API provides function to delete object.

For deleting an object we have to use following function:

session.delete(emp);

Above function will look for primary key from the object and then run the SQL query using JDBC API.

Check following tutorial for complete example code:

Hibernate Session.delete() Example.

Thanks









Related Tutorials/Questions & Answers:
Advertisements