Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 855893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:09:04+00:00 2026-05-15T08:09:04+00:00

We have an JPA @Entity class (say User) which has a @ManyToOne reference (say

  • 0

We have an JPA @Entity class (say User) which has a @ManyToOne reference (say Address) loaded using the EAGER option which in turn loads it’s own @ManyToOne fields (say Country) in a EAGER fashion.

We use the EntityQuery interface to count the list of User’s based on a search criteria, during such a load all the @ManyToOne fields which have been marked as EAGER get loaded. But in order to perform a EntityQuery.resultCount(), I actually don’t need to load the @ManyToOne fields. Is there a way to prevent loading of the EAGER fields in such cases so that we can avoid the unnecessary joins?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T08:09:05+00:00Added an answer on May 15, 2026 at 8:09 am

    Why don’t you use aggregate functions(COUNT in your case) if all you need is the number of records ?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say we have this JPA-annotated class, with a property of type List. This
I have a web application using JPA and JTA with Spring. I would like
Have just started using Visual Studio Professional's built-in unit testing features, which as I
Let's say I have two entities: Group and User. Every user can be member
I am trying to introduce a multi-key constraint on a JPA-mapped entity: public class
I'm using these classes: ShoppingCart <-ManyToMany-> Item <-ManyToOne-> ItemCategory All of them are JPA
I have a simple question regarding Entity declaration in JPA. I have an entity
I have a some JPA entities that inherit from one another and uses discriminator
I have a SEAM app with some JPA/Hibernate entities. And I now wonder where
I have just started migrating my homegrown persistence framework to JPA. Given that the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.