Hi there. I am retrieving a List through Hibernate. The problem is the returned List contains null values. So when I iterate through it, I also ran to those null values. Objects are apart from each other in the List.
Here's the mapping for the parent class Member <list name="reviews"> <key column="member_id"/> <index column="review_id"/> <one-to-many class="Review" /> </list>
Here's the mapping for the child class Reviews <many-to-one name="member" class="Member" column="member_id" not-null="true"/>
Originally posted by Erap Estrada: I already set inverse to true for both. Any more ideas what causing this?
I read somewhere that causing it could be the index column but did not specify how to resolve it.
I am starting to feel hibernate is complicated. All I want is "Member has multiple Reviews" and a "Review has a Member".
Thanks in advance!
[ October 03, 2007: Message edited by: Erap Estrada ]
Hibernate has a good sized learning curve because it is extremely feature rich, and allows you to really set things up exactly how you want it, and with features to make it really fast.
With that in mind, for a simple one to many, try just using a Set first instead of trying a List, since the index-column is there because Lists needing an order.
Try a Set and see how that works for you.
Mark
Erap Estrada
Ranch Hand
Joined: Nov 08, 2006
Posts: 92
posted
0
I apologize if I sound desperate. I temporarily resolve it by creating a utility class to clear the null values in the List.
But I will try to use Set instead and I'll post the result of it here.
Again, thank you so much guys.
Erap Estrada
Ranch Hand
Joined: Nov 08, 2006
Posts: 92
posted
0
Set resolved the issue. Thank you so much!
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.