Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Message from discussion Eager vs Lazy produces different results
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Daryl Stultz  
View profile  
 More options Mar 4 2010, 8:02 am
From: Daryl Stultz <kungfumachin...@gmail.com>
Date: Thu, 4 Mar 2010 05:02:57 -0800 (PST)
Local: Thurs, Mar 4 2010 8:02 am
Subject: Re: Eager vs Lazy produces different results

On Mar 3, 9:48 pm, Rob Bygrave <robin.bygr...@gmail.com> wrote:

> Ok, how about a different example ...

> Lets say you have customers and each customer can have 10000's of orders...
> Aka ... sometimes you don't want ALL beans on a given path.

> Does this example make sense?

Yes, in fact I thought that's the way JPA would work at first. Now
that I understand ORM better, I feel it's proper for the collection to
represent the contents of the database. In this case I would select
orders rather than customers.

Suppose I didn't have join("validRoles") in the query. Wouldn't the
auto fetch figure out I'm using validRoles and automatically join it
in thus changing the behavior? A bit of a shifting sand problem.
Interestingly, when I change the query to this (adding JoinConfig), it
works as I expect:

List<User> result = Ebean.find(User.class).join("validRoles", new
JoinConfig().query()).where().in("validRoles.id", roleIds).findList();

So at least in the name of internal consistency (and with JPA) it
should return everything.

I can work up a JPA example, but it will take a bit so I'll get to it
tonight. I believe OpenJPA will generate a subquery in the where
clause to handle the criteria. So the fetch join and the criteria join
are independent.

/Daryl


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.