#922 - NPE Issue with ebean-elastic and multi-tenant Ebean ... NPE at DLoadContext line 96

This commit is contained in:
Rob Bygrave committed 2016-12-14 00:53:30 +13:00
1 parent cf37fda3f4
commit 4941134ce1
4 files changed
+25 -1

No files matched your search

@@ -97,6 +97,13 @@ public abstract class BeanRequest {
return transaction;
}
/**
* Set the transaction to use for this request.
*/
public void setTransaction(SpiTransaction transaction) {
this.transaction = transaction;
}
/**
* Return true if SQL should be logged for this transaction.
*/
@@ -532,4 +532,10 @@ public final class OrmQueryRequest<T> extends BeanRequest implements BeanQueryRe
query.setDefaultFetchBuffer(fetchSize);
}
/**
* Return the tenantId associated with this request.
*/
public Object getTenantId() {
return (transaction == null) ? null : transaction.getTenantId();
}
}
@@ -93,7 +93,7 @@ public class DLoadContext implements LoadContext {
public DLoadContext(OrmQueryRequest<?> request, SpiQuerySecondary secondaryQueries) {
this.tenantId = request.getTransaction().getTenantId();
this.tenantId = request.getTenantId();
this.persistenceContext = request.getPersistenceContext();
this.ebeanServer = request.getServer();
this.defaultBatchSize = request.getLazyLoadBatchSize();