mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-18 14:58:47 +00:00
#360 ENH: Add query setDisableLazyLoading(true) ... for use when graph serialised via external library (and you don't want lazy loading to fire)
This commit is contained in:
1 parent
59d009bc94
commit
3d4bd15dac
14 files changed
+239
-39
No files matched your search
@@ -83,6 +83,11 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
|
||||
|
||||
private int firstRow;
|
||||
|
||||
/**
|
||||
* Set to true to disable lazy loading on the object graph returned.
|
||||
*/
|
||||
private boolean disableLazyLoading;
|
||||
|
||||
/**
|
||||
* Lazy loading batch size (can override server wide default).
|
||||
*/
|
||||
@@ -710,6 +715,7 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
|
||||
builder.add(firstRow).add(maxRows).add(orderBy).add(forUpdate);
|
||||
builder.add(rawWhereClause).add(additionalWhere).add(additionalHaving);
|
||||
builder.add(mapKey);
|
||||
builder.add(disableLazyLoading);
|
||||
builder.add(id != null);
|
||||
builder.add(asOf != null);
|
||||
builder.add(rawSql == null ? 0 : rawSql.queryHash());
|
||||
@@ -1138,6 +1144,16 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
|
||||
this.includeTableJoin = includeTableJoin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Query<T> setDisableLazyLoading(boolean disableLazyLoading) {
|
||||
this.disableLazyLoading = disableLazyLoading;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isDisableLazyLoading() {
|
||||
return disableLazyLoading;
|
||||
}
|
||||
|
||||
public int getFirstRow() {
|
||||
return firstRow;
|
||||
}
|
||||
|
||||
@@ -341,6 +341,9 @@ public class OrmQueryProperties implements Serializable {
|
||||
if (filterMany != null) {
|
||||
filterMany.queryPlanHash(request, builder);
|
||||
}
|
||||
builder.add(lazyFetchBatch);
|
||||
builder.add(queryFetchBatch);
|
||||
builder.add(queryFetchAll);
|
||||
}
|
||||
|
||||
public String getProperties() {
|
||||
|
||||
Reference in new issue
Block a user