Can you make a query specifying that you only want a specific Ref field marked with @Load to load?

14 views
Skip to first unread message

Tony Park

unread,
May 9, 2023, 6:03:23 PM5/9/23
to objectify-appengine
I have an entity with two Ref fields marked with @Load so loads are batched when making queries.However, is it possible to make a query and specify that I only want one of the Ref fields to load with @Load? I have a situation where I have two different queries and each query only needs one of the Ref fields to load but not both. Is this somehow possible using Load Groups?

@Entity
public class Thing {
    @Id Long id;
    @Load Ref<Other> other;
    @Load Ref<Other> someOther;
}

Jeff Schnitzer

unread,
May 9, 2023, 6:19:40 PM5/9/23
to objectify...@googlegroups.com
Yep, that's exactly what load groups are for. Looks like you found the documentation - is it confusing?

Jeff

--
You received this message because you are subscribed to the Google Groups "objectify-appengine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to objectify-appen...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/objectify-appengine/43636e40-ff6d-4f54-8706-31f928f923a7n%40googlegroups.com.

Tony Park

unread,
May 11, 2023, 6:51:40 PM5/11/23
to objectify-appengine
That's exactly what I am looking for then. I wasn't sure with the documentation. I was able to create a query using load groups this way and it worked. Thank you.

List<Car> cars = ofy().load().group(Partial.class).type(Car.class).filter("year >", 1999).list();
Reply all
Reply to author
Forward
0 new messages