-
-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to configure fetch batch size when using FetchGroups #3313
Comments
FetchGroup can be static final so what I'd expect to see is instead: // create the FetchGroup once
static final FetchGroup<User> MY_FETCH_GROUP = FetchGroup.of(User.class)
. tickets.fetchQuery()
.build()
Query<User> query = DB.getDefault().createQuery(User.class)
.select(MY_FETCH_GROUP)
.build()
Yes, we are missing the ability to do this is a strong typed way like: A) specify the FetchConfig static final FetchGroup<User> MY_FETCH_GROUP = FetchGroup.of(User.class)
.tickets.fetch(FetchConfig.ofQuery(1000)) // <!-- specify the FetchConfig here
.build() B) specify the FetchConfig with properties static final QTicket TICKET = QTicket.alias();
static final FetchGroup<User> MY_FETCH_GROUP = FetchGroup.of(User.class)
// specify the FetchConfig with properties
.tickets.fetch(FetchConfig.ofQuery(1000), TICKET.price, TICKET.availableFrom)
.build()
Yes, we can do this using the fetch() method on query beans that matches fetch(String,String,FetchConfig) static final FetchGroup<User> MY_FETCH_GROUP = FetchGroup.of(User.class)
// WORKAROUND (with specific properties)
.fetch("tickets", "price, availableFrom", FetchConfig.ofQuery(1000))
// or without properties
// .fetch("tickets", FetchConfig.ofQuery(1000))
.build() |
…d query beans We can do this currently using string paths and properties, this adds support for doing this when using query beans and strong types
Supporting this via For example: private static final FetchGroup<Customer> FETCHGROUP_CustomerWithContacts =
QCustomer.forFetchGroup()
.select(cu.name, cu.phoneNumber)
.contacts.fetch(FetchConfig.ofQuery(1000), co.firstName, co.lastName, co.email)
.buildFetchGroup();
new QCustomer()
.select(FETCHGROUP_CustomerWithContacts)
.findList(); |
…config #3313 Ability to configure fetch batch size when using FetchGroups and query beans
We use extensivly a pattern like this
But we can't configure this fetch on 'tickets' (like the fetch method allow on query with
query.fetch(String, FetchConfig)
).It might make sens to have:
Or did I miss an alternative way to do this?
Btw thank you a lot for your work on this project that we use for years now 🙏
The text was updated successfully, but these errors were encountered: