You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ebean is generating me 10s of transactions ending like this.
....
where t0.id = any(Array[10]={230430,230431,230432,230433,230434,230435,230436,230437,230438,230439});
where t0.id = any(Array[10]={230440,230441,230442,230443,230444,230445,230446,230447,230448,230449});
where t0.id = any(Array[10]={230450,230451,230452,230453,230454,230455,230456,230457,230458,230459});
where t0.id = any(Array[10]={230460,230461,230462,230463,230464,230465,230466,230467,230468,230469});
where t0.id = any(Array[10]={230470,230471,230472,230473,230474,230475,230476,230477,230478,230479});
...
I have set up configuration like following, but still batch size 10 items as one transaction. Do I need to configure something else?
public class EbeanStartupConfig implements ServerConfigStartup {
public void onStart(ServerConfig serverConfig) {
serverConfig.setQueryBatchSize(100);
serverConfig.setLazyLoadBatchSize(100);
}
}
Sorry for the very late reply. I had a closer look at this.
The queries where t0.id = any(Array[10]={...}) are Ebean's batch lazy loading: a lazy association gets loaded for 10 beans at a time, each batch in its own implicit transaction. With play-ebean 5.0.2 you are on Ebean 11.33.2, where the default lazyLoadBatchSize is 10. So batches of exactly 10 mean that your setLazyLoadBatchSize(100) never took effect. These are the possible reasons:
1. Your ServerConfigStartup is not picked up (most likely)
Play Ebean passes the classes configured via ebean.default = [...] explicitly to Ebean, which disables Ebean's own classpath scanning. So Ebean only runs a ServerConfigStartup that is covered by an ebean. config line, any other one gets silently ignored. If EbeanStartupConfig is not in your models package, either move it there, or add it to the config, e.g.:
On older versions of the sbt plugin, list single classes like that after your packages: an entry the bytecode enhancer can't handle stopped the enhancement of all following entries, so your models might have ended up not being enhanced. That's fixed now (#895, #896, #897). The docs now also point out that a ServerConfigStartup has to be covered by an ebean. config line (#898).
To check if it is picked up, add a log statement (or breakpoint) to onStart.
2. A query overrides the batch size
If onStart does run, the batch size of 10 most likely comes from the query itself, e.g. FetchConfig.ofLazy(10) or setLazyLoadBatchSize(10).
3. Avoid the lazy loading altogether
A larger batch size only divides the number of queries. If you know you will access the association, better load it with the query: fetch("association") (join) or fetchQuery("association") (separate query, using queryBatchSize, which defaults to 100).
Also note that since Ebean 16.0.0 the default lazyLoadBatchSize is 100, and Play 2.7 / play-ebean 5.x are not maintained anymore, so upgrading would also help here.
I'm closing this issue for now. If the problem still isn't solved, feel free to re-open it, and please include your ebean.* config, the package of your ServerConfigStartup class, whether onStart gets called, and the code of the query.
Activity
mkurz commentedon Oct 8, 2026
Sorry for the very late reply. I had a closer look at this.
The queries
where t0.id = any(Array[10]={...})are Ebean's batch lazy loading: a lazy association gets loaded for 10 beans at a time, each batch in its own implicit transaction. With play-ebean 5.0.2 you are on Ebean 11.33.2, where the defaultlazyLoadBatchSizeis 10. So batches of exactly 10 mean that yoursetLazyLoadBatchSize(100)never took effect. These are the possible reasons:1. Your
ServerConfigStartupis not picked up (most likely)Play Ebean passes the classes configured via
ebean.default = [...]explicitly to Ebean, which disables Ebean's own classpath scanning. So Ebean only runs aServerConfigStartupthat is covered by anebean.config line, any other one gets silently ignored. IfEbeanStartupConfigis not in your models package, either move it there, or add it to the config, e.g.:On older versions of the sbt plugin, list single classes like that after your packages: an entry the bytecode enhancer can't handle stopped the enhancement of all following entries, so your models might have ended up not being enhanced. That's fixed now (#895, #896, #897). The docs now also point out that a
ServerConfigStartuphas to be covered by anebean.config line (#898).To check if it is picked up, add a log statement (or breakpoint) to
onStart.2. A query overrides the batch size
If
onStartdoes run, the batch size of 10 most likely comes from the query itself, e.g.FetchConfig.ofLazy(10)orsetLazyLoadBatchSize(10).3. Avoid the lazy loading altogether
A larger batch size only divides the number of queries. If you know you will access the association, better load it with the query:
fetch("association")(join) orfetchQuery("association")(separate query, usingqueryBatchSize, which defaults to 100).Also note that since Ebean 16.0.0 the default
lazyLoadBatchSizeis 100, and Play 2.7 / play-ebean 5.x are not maintained anymore, so upgrading would also help here.I'm closing this issue for now. If the problem still isn't solved, feel free to re-open it, and please include your
ebean.*config, the package of yourServerConfigStartupclass, whetheronStartgets called, and the code of the query.