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

  ::. About the Author .::

Java4s_Author
- Full Stack Java/J2EE & UI Web Developer
Founder of Java4s - Get It Yourself, A popular Java/J2EE Programming Blog, Love Java and UI frameworks.
You can sign-up for the Email Newsletter for your daily dose of Java tutorials.

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.
Most Recent Posts from Top Categories
Hibernate Spring Struts
Contact | About Us | Privacy Policy | Advertise With Us

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