#1566 - ENH: Support query.setBaseTable() ... to query against dynamic table (ala manual table partitioning)

This commit is contained in:
rob bygrave committed 2019-01-09 19:13:35 +13:00
1 parent 3207ae1f08
commit cd8c12a9a8
6 files changed
+97 -7

No files matched your search

@@ -235,6 +235,8 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
*/
private String rootTableAlias;
private String baseTable;
/**
* The node of the bean or collection that fired lazy loading. Not null if profiling is on and
* this query is for lazy loading. Used to hook back a lazy loading query to the "original" query
@@ -764,6 +766,7 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
copy.profilingListener = profilingListener;
copy.profileLocation = profileLocation;
copy.baseTable = baseTable;
copy.rootTableAlias = rootTableAlias;
copy.distinct = distinct;
copy.timeout = timeout;
@@ -1082,6 +1085,9 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
if (disableLazyLoading) {
sb.append(",disLazy:");
}
if (baseTable != null) {
sb.append(",baseTable:").append(baseTable);
}
if (rootTableAlias != null) {
sb.append(",root:").append(rootTableAlias);
}
@@ -1858,6 +1864,17 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
}
}
@Override
public Query<T> setBaseTable(String baseTable) {
this.baseTable = baseTable;
return this;
}
@Override
public String getBaseTable() {
return baseTable;
}
@Override
public DefaultOrmQuery<T> alias(String alias) {
this.rootTableAlias = alias;