Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

CGLIB Proxy even when calling query to load object

 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Has anyone seen an issue where they are running a query which will load a Collection, but because one of the Objects that would be in the result set was already lazy loaded before, that the collection has all real objects and one Proxy.

For instance we have an Event object which has a Main Photo and a Collection of Photos.

When we retrieved the Event object the MainPhoto object was assigned with a Proxy object, the Collection of Photos wasn't loaded at all.

Then we called a Repository that would get all the Photos for an event and assign the returned List to the event.setPhotos(List<Photo> photos). In the List of photos is all the photos as fully initialized domain objects with real data and the mainphoto still as a proxy.

And no it isn't calling photos.add(mainPhoto), the main photo is a photo that is in the list and returned by the query to get all the photos of the event.

Thanks

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic