• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

For each and collections/sets returning inaccurate results

 
Joshua Elkino
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an image embeddable object.


In my entity object i have a collection of these images.


Now i have 1 image for 1 entity object currently. I see this on the table. When i run this loop in a jsp page (and yes i know i shouldn't use java in jsp).. i get incorrect # of images.



Anyone know why this is happening? If i restart the server, i get a different # of images. Its the same image just repeating too many times. If i do a entity.getImages().size() i also get an incorrect value. Sometimes all the way up to 265 or so.

Thanks
 
ntumba lobo
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If as you say your data in your database are correct, this must come from the generated sql request.

what does the sql request look like ?
 
Cristian Vrabie
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not really good with annotation mappings (i prefer xml) so I'm not sure what's really going on there, but are you sure that's a correct mapping of a one-to-many relation?
 
Joshua Elkino
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I added

and that seemed to fix the issue.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic