"fetch" as synonym for "join"

230 views
Skip to first unread message

Rob Bygrave

unread,
Mar 25, 2010, 4:26:02 PM3/25/10
to ebean@googlegroups
Daryl suggested that "fetch" would be a better word rather than "join" and I agree.

find order
join customer
join customer.billingAddress
...

could instead be:

find   order
fetch customer
fetch customer.billingAddress
...


Ebean.find(Order.class)
  .fetch("customer")
  .fetch("customer.billingAddress")
  .findList();


The thinking here is that "join" is ambiguous and confusing,  especially in relation to SQL joins.

"fetch" is a much better reflection of the actual behaviour.

Other possible candidates could be "fetchjoin", "fetchpath" ?


If there is no objection I'd be keen to make "fetch" a synonym for "join" so that both work and change the documentation over to use "fetch".

Feedback welcome.


Thanks, Rob.

Rob Bygrave

unread,
Mar 28, 2010, 3:28:33 AM3/28/10
to Ebean ORM
BTW Eddie was +1 ... so 3 nil, we will go ahead and make "fetch" a
synonym for "join" ... and move over to "fetch" as the preferred word.

- Rob.

Rob Bygrave

unread,
Mar 30, 2010, 5:10:25 PM3/30/10
to Ebean ORM

This is now in HEAD.

... so you can use:
- fetch in the query language
- fetch on the Query object (criteria API)

Note: there is a FetchConfig which is pretty much an exact copy of
JoinConfig.
You have to use FetchConfig with the query.fetch(...) methods.

When folks move over to using "fetch" ("join" will still work for some
time) ... with the Query api when you change to use the "fetch"
methods any JoinConfig objects need to change to FetchConfig objects.

At some point the join methods will become deprecated and with it the
JoinConfig object will become deprecated.

Example:

List<Customer> list = Ebean.find(Customer.class)
.select("id, name, status, shippingAddress")
.fetch("billingAddress", new FetchConfig().query())
.fetch("billingAddress.country","*")
.order().desc("id")
.findList();


Cheers, Rob.

Reply all
Reply to author
Forward
0 new messages