Get all updates of Java4s
Follow Us: Email Newsletter

Hibernate One to Many Select Query Example

Hibernate » On Jul 22, 2011 { 9 Comments } By Sivateja

Let us see the logic for hibernate one to many mapping select query,

hibernate one to many select means, if you select the parent object then automatically its corresponding child objects will also be selected, see i have given for the logic for selecting single parent object with all its childs & all parent objects with all child objects

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

Files required..

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




Select Single Parent Object With All Child

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

Select All Parent Objects With All Childs

You Might Also Like

  ♦ About Author ♦

Full Stack( Java/J2EE & UI/UX ) Developer and founder of Java4s - Get It Yourself, A popular Java/J2EE Programming Blog. Sign-up for the Email Newsletter for your daily dose of Java tutorials.


9 Responses to “Hibernate One to Many Select Query Example”
  1. Mandar says:

    Plz some one tell me How i use one to many mapping in hibernate for creation of three tables.

    Thanks in advance

    Plz rply its argent

  2. bk says:

    hi… the information given by you is very impressive , and can you provide information about the “Detached Criteria”. Thanks

  3. basha says:


    what is “insert” attribute in mapping files. Can you explain clearly?

  4. karthick says:

    nicely explained but…pls tell me why we set “insert=false” in hbm.xml….

  5. swapnil says:

    nice example! :-) & cleared my concept

  6. Krishna says:

    Wonderful exaples Siva Tej really great job thank you soo much

  7. HT says:

    is there any way to select all parent objects with some chidren? say all vendors that has customer name = John

  8. vindhyachal says:

    thank u so much for this example

  9. Prathaap says:

    Hi Java4s,

    Not able to see Hibernate Relationships In Depth link( Please provide us the link. Thanks!


By posting your answer, you agree to our comments policy.
What would you like to learn today?
Browse these popular technologies
Hibernate spring struts Servlets ajax Log4j jQuery Json Core Java Web Services AngularJs
Most Recent Tutorials
Hibernate_Logo Hibernate Recent Posts Spring_Logo Spring Recent Posts Struts_Logo Struts Recent Posts
Useful Links Current & UpComing Tutorials
  Web Services [ SOAP ], JSP
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.