• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mapping Collection in Hibernate.

 
Siddharth Bhargava
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am starting to learn how to map collection in Hibernate. I saw various examples in net but I am finding it too confusing and unable to understand how to implement it practically. Please could anyone point me to a place where it is explained in a very simple and lucid manner so that I can get the basic concepts?. Moreover I am reading from the book "Java Persistance with Hibernate" by Christian Bauer and Gavin King.


Thanks and Regards,
Sid.
 
Anantha Sharma
Ranch Hand
Posts: 43
Android Hibernate jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the book from Christian Bauer is the best on yet on hibernate..

you can visit hibernate support documentation for a more examples hibernate docs (3.3)

if that doesen't help please revert with the actual mapping you are trying to create & i'm sure we can help you with it.
 
prathamesh bandivadekar
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have tried the same thing with hibernate!

Here i will take an example of Employee object.

An Employee can be associated with multiple departments.

So now our Employee can have a collection of Dept objects.

So now i can map this Dept Collection in Hibernate using <one-to-many> tag specified in Employees.hbm.xml

Where, for Dept i will have seperate Dept.hbm.xml describing Dept object properties.

If you want i can share the code with you!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic