• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate 3 Not Loading Values Into Child Set In JUnit Test

 
Michael Duffy
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I"m trying to use Hibernate 3 with Spring. I've got two classes with a unidirectional parent-child relationship: QuestionnaireResponse and Answer. A QuestionnaireResponse has a child Set of Answers. I've attached the Hibernate mapping below (just to keep the narrative together).

Of course I'm writing JUnit tests. I've got a test where I query for a particular QuestionnaireResponse and check the result I get back. The query is returning the right response for a given individual, but when I check to see if the associated answers are included I find that the Set size is zero instead of the 24 I expected from the database values.

I've set it up so I'm using eager loading. What did I miss with Hibernate? Why is it not getting the assocated Answers in this simple 1:m relationship? Thanks.

QuestionnaireResponse.hbm.xml

 
Chris OConnell
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm having the same sort of problem. However, I have a relationship that 'sometimes' load and sometimes doesn't. Anyone else seen this sort of behavior?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic