aspose file tools*
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
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: 18570
    
    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: 255

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


Regards
Salil Verma
 
 
subject: Hibernate: mapping results to ArrayList of Objects