• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

hibernate

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I want to know how to use one to many relationship for List type in Hibernate.
I wil b grateful for anyone who tries to reply this.. Thanks in advance
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"vijayaY vijayaY", please check your private messages again for an important administrative matter.
 
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


All you need to do is create your two classes, and in the encapsulating class, declare a list of instances of the encapsulated class. So, a Team has Players, right? Well, you could create a Team class that has a List of Players:




Of course, you'd need the Player class as well.



Then, it's just a matter of writing normal Java code that uses the Hibernate and JPA annotated classes!





It's all that easy!

Here's the full Hibernate3 tutorial if you're interested:

Doing One to Many and Many To One Associations with Hibernate and JPA Annotations

-Cameron McKenzie
 
reply
    Bookmark Topic Watch Topic
  • New Topic