• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

CGLIB Proxy even when calling query to load object

Posts: 17346
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.


I once met a man from Nantucket. He had a tiny ad
Free, earth friendly heat - from the CodeRanch trailboss
    Bookmark Topic Watch Topic
  • New Topic