This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Hibernate: mapping results to ArrayList of Objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate: mapping results to ArrayList of Objects" Watch "Hibernate: mapping results to ArrayList of Objects" New topic
Author

Hibernate: mapping results to ArrayList of Objects

laura mccord
Ranch Hand

Joined: Feb 10, 2009
Posts: 108
Hi

I need help figuring out why my results are not mapping entirely. I feel like I'm forgetting something. I've used this before in other code scenarios and it worked but it doesn't seem to work for me this time.

It's very simple and it comes down to this line of code



The size of the result items is correct (9).

I ran the hibernate sql statement that is logged in catalina.out against my SQL Developer and I get 9 DISTINCT records as there should be. However, when I iterate through the ArrayList of Objects (Checklist) only the first record in the array is displayed 9 times. This is how I am displaying my arraylist....



I don't know what I'm doing wrong and I'm stuck because it looks correct to me.

Thanks in advance.

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

It might help to look at your Checklist class to see if perhaps the getRequirement() method (and the others as well) access a static variable, or something like that.
laura mccord
Ranch Hand

Joined: Feb 10, 2009
Posts: 108
Hi Paul,

Thanks for the quick response.

I verified that my Checklist domain class does not have any static variables (attached below). Could there be something in my hibernate configuration or application context that could be throwing something off?

Thanks,
Laura



Gopakumar Naryanan
Ranch Hand

Joined: Jan 15, 2011
Posts: 72


Please provide the code of your Model/DAO class where you execute the Query..


Thanks & Regards
Gopakumar
Salil Vverma
Ranch Hand

Joined: Sep 06, 2009
Posts: 253

Have you enabled any type of caching in the project ?
Can you please let us know your hibernate configuration and mapping ?


Regards
Salil Verma
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate: mapping results to ArrayList of Objects
 
Similar Threads
Hibernate + Spring + Oracle: Help, can't get connection working
Hibernate - Query Issues With Many-To-One Relationships
Problem with Hibernate
Problem in hibernate join result
Composite Key Mapping with OneToMany does not work