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
 
Rob Bygrave  
View profile  
 More options Mar 4 2010, 3:37 pm
From: Rob Bygrave <robin.bygr...@gmail.com>
Date: Fri, 5 Mar 2010 09:37:04 +1300
Local: Thurs, Mar 4 2010 3:37 pm
Subject: Re: [ebean] Re: Eager vs Lazy produces different results

> this is a "partial object graph", yes?

I would not call it that no.

For me the question is ... for a *ToMany path do you ever want to supply a
filter on that path (or conversely do you ALWAYS want to get ALL the beans
for that path (so this really only applies to the *ToMany paths).

So, lets say each customer had tens of thousands of Orders ... maybe we
think it is too expensive to practically navigate from customer to orders...
so perhaps you never allow it and remove the orders property from the
Customer entity bean and make it uni-directional.  *You have just modified
your ORM model purely due to cardinality.*

You then always have to navigate your model the other way - from order to
customer.

> In this case I would select orders rather than customers.

You would indeed build a similar object graph but it not exactly the same.
Your root objects are Orders and not Customers - and if you want to process
Customers primarily (with their new orders) you have some work to do to find
the list of unique customers first and then ...

Note that you never do this in the relational model - the relationship still
exists no matter the cardinality - and you can still use SQL to join both
ways.

> I can work up a JPA example...

That would be good. The generated SQL will clarify things.

> I assume I can add/remove from the filtered list and save it without

blowing away all the records I didn't load?

Yes you can. You assumption is correct.

> JoinConfig().query() ...

Hmmm, I'll have a look at that (I'd suggest that is a bug).

... but first I want to clarify that we do want the ability to apply a
filter on the *ToMany (and not having that ability can be a real problem).
Aka that we should get 1 role in the list and not 2 (and if you wanted to
filter the users in this case we should use a subquery ... and that should
actually match the SQL that is generated by the JPA query).

Cheers, Rob.

On Fri, Mar 5, 2010 at 2:22 AM, Daryl Stultz <kungfumachin...@gmail.com>wrote:

> On Mar 3, 9:48 pm, Rob Bygrave <robin.bygr...@gmail.com> wrote:
> > ...  I want to filter the customer orders to just get the
> Order.Status.NEW
> > ones since last week (for all the customers starting with 'A%'.

> In a sense, this is a "partial object graph", yes? I assume I can add/
> remove from the filtered list and save it without blowing away all the
> records I didn't load? I don't have a problem with the concept, it's
> just that in this case I don't *feel* like I asked for a partial
> graph.

> /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.