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 6 2010, 4:47 pm
From: Rob Bygrave <robin.bygr...@gmail.com>
Date: Sun, 7 Mar 2010 10:47:02 +1300
Local: Sat, Mar 6 2010 4:47 pm
Subject: Re: [ebean] Re: Eager vs Lazy produces different results


Map<Customer, Map<DeliveryMethod, Map<Order, List<OrderItems>>>>
resultMap = Ebean.query(OrderItems.class).findGroups("order.customer",
"order.deliveryMethod", "order") // el expression
<<

Very interesting ... I like it.


Question is if Ebean can make any use of the information (for
performance) that it has to find a map or group, else the findGroups()
method can also be a utility method in your application.
With a little bit of reflection magic you can do that.
<<

My instinct (assuming I understood the example of course) suggests there
would be no big performance gain to be had except that Ebean can do it
without reflection.  That is... I think we still need to build the original
object graph structure... and to do a 'second pass' to go through the
original object graphs and build the map.

Hmmm, it does look like a pretty useful feature though.

Getting back to Option 1 and Option 2 ...

*I am strongly in favour of going with option 2 which means we'd do the same
thing as JPQL. This means people need to show there support for Option 1
(the status quo) ... otherwise we will make this change.
*
I was thinking we could add something like:

Ebean.find(Customer.class)
  .where().startsWith("name","A")
  .*filterMany()*.eq("orders.status",
Order.Status.NEW).gt("orders.orderDate", lastWeek)

... so that meant .. filter on the *ToMany (orders)... returning new orders
in the last week.

Daryl, Mario ... are you happy to go with Option 2 ?

Anyone out there supporting the status quo (Option 1) ?

Thanks, Rob.

On Sun, Mar 7, 2010 at 6:18 AM, Mario Ivankovits <mario.ivankov...@gmail.com

> wrote:
> Hi!

> > We talked about the case of Customers and Orders. I suggested
> > selecting Orders rather than Customers which leads to the problem of
> > organizing Orders by Customers. It seems like (a variation of?)
> > query.findMap() could take care of this:

> > query = Ebean.find(Order.class)...
> > query.setMapKey("customer");
> > Map<Customer, List<Order>> resultMap = query.findMap();

> This is something I could have made use of sometimes either.

> In fact, today I query the Order.class and build the map manually then
> by walking through the list in a first pass and fetch the customer
> property.

> Hmmm .... and when I think of, it often gets even more complicated and
> ends in something like this:

> Map<Customer, Map<DeliveryMethod, List<Order>>> resultMap = ....

> Such a result is also easily built by walking through the list in a
> first pass.

> I think it is much like the gropu by feature in sql plus keeping the
> detail data.

> Which then might look like this (I bring OrderItem in the game now):

> Map<Customer, Map<DeliveryMethod, Map<Order, List<OrderItems>>>>
> resultMap = Ebean.query(OrderItems.class).findGroups("order.customer",
> "order.deliveryMethod", "order") // el expression

> Question is if Ebean can make any use of the information (for
> performance) that it has to find a map or group, else the findGroups()
> method can also be a utility method in your application.
> With a little bit of reflection magic you can do that.

> Ciao,
> Mario


 
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.