File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes Hibernate not loading associated collection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate not loading associated collection" Watch "Hibernate not loading associated collection" New topic

Hibernate not loading associated collection

surya sudhakar

Joined: Jun 11, 2002
Posts: 18
I have two tables called proj and proj_team_member. The persistant classes for these two are Project and ProjectTeam. There is an association between the two tables. A project can have multiple team members.
The table proj_team_member has a composite primary key on columns proj_id, role_id and person_pin
This is how I have implemented the bi-directional navigation.

I have created a Set in the Project to hold the collection of ProjectTeam objects. And the ProjectTeam has a reference to Project

Here are the mappings of the persistance classes

When I am trying to get load a ProjectTeam using a person_pin I am able to load the ProjectTeam object, with this I am able to navigate to Project object also to see the project details.

The problem is with the loading the Project like below

I am able to get the project detail, but it is not loading the Set of ProjectTeam rows(object), though I have a team for the project. The list size is coming as zero.

Could somebody please let me know where the mistake is? I am seeing in the Hibernate log that the collection is being loaded


Any help in resolving this will be greatly appreciated.

I agree. Here's the link:
subject: Hibernate not loading associated collection
It's not a secret anymore!