• Post Reply Bookmark Topic Watch Topic
  • New Topic

JPA Criteria

Ron Patel
Posts: 18
  • Mark post as helpful
  • send pies
  • 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?
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!