• 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 ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

JPA Criteria

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm having a problem with JPA/Hibernate that is driving me crazy and was wondering if anyone could help.

I am running a JPA query using Hibernate criteria. I create a Criteria using the JPA runtime's underlying Session.

However, when this criteria runs, I see that JPA runs my criteria first and fetches the correct data. Then, before returning to me, it goes out to the database a second time to fetch every piece of data there, including things that do not match the criteria.

This occurs when I have the FetchMode set to EAGER or LAZY; it doesn't matter.

Has anyone ever encountered this behaviour before? Is there any way around this?
reply
    Bookmark Topic Watch Topic
  • New Topic