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

  • Home
  • SEARCH
  • 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 8547455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:16:11+00:00 2026-06-11T13:16:11+00:00

In this code I fetch a user by username and password using GWT RequestFactory

  • 0

In this code I fetch a user by username and password using GWT RequestFactory

  userContextProvider.get().getUser(userName, password).with(extraData).
    fire(new Receiver<User>() {
        @Override
        public void onSuccess (User user) {
        //Do something  
        @Override
        public void onFailure(ServerFailure error) {
          //Error
        }
    });

A user can have one or many groups, so normally, in the extraData I would have

String [] extraData = {groups};

In my DAO I fetch the user like this

   Criteria c = session.createCriteria(User.class);
   c.add(Restrictions.eq("user", username));
   c.add(Restrictions.eq("password", password));            
   utilisateur =  (Utilisateur) c.uniqueResult();

And in the User model, the group collection is set to lazy

@ManyToMany(fetch = FetchType.LAZY, mappedBy = "users")
    public List<Group> getGroups() {
        return this.groups;
    }

But, in Hibernate Log I see two queries, one for the user (that’s ok) and the other for the groupe

My question is : Is it normal that with in RequestFactory override the lazy loading of Hibernate ? and how to work around it ?

  • 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-06-11T13:16:12+00:00Added an answer on June 11, 2026 at 1:16 pm

    Think a minute about what’s happening.

    You’re asking for a user entity with its groups, in one request. So the server prepares the user and groups to send them back to your GWT client app.

    If you want lazy fetching on the client-side, then ask for the user, then when needed ask for its group, as a separate request (with its separate RequestContext instance, Receiver, and call to fire())

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

Sidebar

Related Questions

I'm trying to fetch information from a JSON web service with this code, using
I am trying to log in using this code : session_start(); require connect.php; $username
I am using membership api to fetch the user password and email. I have
This code comes from: http://code.activestate.com/recipes/577090-file-encryption-using-stream-cipher/ import sys import random if len(sys.argv) != 4: print
In my app I'm using an NSUserDefaults object to store the username, password and
This is the code I have, but I get this error when I try
This code below allows me to find the word error in all my files
This code is the core of a much larger script that works great in
This code disabled mouse scroll functionality, when i click on the document. $(document).on(click, function
This code only renders a dodecahedron and completely ignores the glBegin(GL_TRIANGLES) block: glutSolidDodecahedron(); glBegin(GL_TRIANGLES);

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.