Get all updates of Java4s
Newsletter

Hibernate One to Many Mapping Delete Query Example

Hibernate »on Jul 22, 2011 { 6 Comments } By Sivateja

Let us see the logic for hibernate one to many mapping delete query, Actually every thing is same like Hibernate One-to-Many Mapping Insert  but only change is in OurLogic.java file.

But mates, ensure you came through these sessions for better understand

Files required..

  • Vendor.java [pojo class]
  • Customer.java [pojo class]
  • OurLogic.java
  • Customer.hbm.xml
  • hibernate.cfg.xml
  • Vendor.hbm.xml

Vendor.java

Customer.java

Customer.hbm.xml

Vendor.hbm.xml

hibernate.cfg.xml

Deleting Single Parent Object With All Child

OurLogic.java

If we want to delete all the parent objects will all its corresponding child objects., then the logic will be like..

Deleting All Parent Objects With All Childs

OurLogic.java

You Might Also Like

Comments

6 Responses to “Hibernate One to Many Mapping Delete Query Example”
  1. chandra says:

    can you please give detailed tables on other relations also .

  2. thayeef says:

    Hi,
    Very nice tutorial .Thanks alot.

  3. karthick says:

    shall we use …..
    createQuery(“delete from Vendor v”); instead of above query…

    pls reply… :)

  4. Gourav Bohra says:

    Shall we use …..
    createQuery(“delete from Vendor v”); instead of above query…

    pls reply… :)

Name*
Mail*
Website



By posting your answer, you agree to our comments policy.
What would you like to learn today?
Browse these popular technologies
Spring-Boot-tutorials Hibernate tutorials Spring tutorials Struts tutorials Servlets tutorials Ajax tutorials Log4j tutorials jQuery tutorials Json tutorials Core Java tutorials Web Services tutorials AngularJs tutorials
Most Recent Tutorials
Hibernate_Logo Hibernate Recent Posts Spring_Logo Spring Recent Posts Struts_Logo Struts Recent Posts
Contact | About Us | Privacy Policy | Advertise With Us

© 2010 - 2017 Java4s - Get It Yourself.
The content is copyrighted to Sivateja Kandula and may not be reproduced on other websites.