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 6026639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:28:29+00:00 2026-05-23T04:28:29+00:00

I am using spring + hibernate in my project; I have two classes Reminder

  • 0

I am using spring + hibernate in my project; I have two classes Reminder and Client
in class reminder i have added a relationship of many to one for client and it is by default eagerly loaded. I want this Object graph most of the scenarios in my project so i have set fetch type eager for client in reminder class

Class Reminder {
    @ManyToOne
    Client client;
}

but for one or two scenarios i want to keep initialization of this object client lazy;

so i have added in method for fetching reminders is like below

Criteria c = session.createCriteria();
c.setFetchMode("client", FetchMode.SELECT); 
hibernateTemplate.findByCriteria(criteria);

it is not working; it still loads client objects with reminder

while reverse (from lazy to eager) is working fine

  • 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-23T04:28:30+00:00Added an answer on May 23, 2026 at 4:28 am

    From the api doc:

    public static final FetchMode SELECT

    Fetch eagerly, using a separate select. Equivalent to fetch="select"
    

    AFAIK, if a mapping is marked as lazy, you may fetch eagerly using a criteria or HQL query, but you can’t do the reverse : if a mapping is marked as eager, then it’ll always be fetched eagerly.

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

Sidebar

Related Questions

I have recently setup a spring + hibernate project. I am using oracle DB.
I am creating a project using maven with spring and hibernate. I added a
I'm trying to set up a project using hibernate.I have two tables : Users
I have created a Spring 3 + Hibernate project using Maven in Eclipse. How
I have some web-project (Spring MVC + Hibernate). For hibernate objects I am using
I am developing project using Spring , Struts2 & Hibernate . Now I want
Hey I am developing an desktop application using Spring and Hibernate, and I have
I have an extremely simple web application running in Tomcat using Spring 3.0.2, Hibernate
In my project I can successfully test database code. I'm using Spring, Hibernate, HSQLDB,
I am currently developing my project using Spring, Sutruts2 & Hibernate. Now i want

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.