mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-17 22:56:28 +00:00
Merge branch 'extrawhere-on-join' of https://github.com/FOCONIS/ebean into FOCONIS-extrawhere-on-join
This commit is contained in:
commit
8c9dae0f88
4 files changed
+30
-26
No files matched your search
@@ -518,6 +518,17 @@ class SqlTreeNodeBean implements SqlTreeNode {
|
||||
ctx.append(inheritInfo.getWhere()).append(" ");
|
||||
}
|
||||
}
|
||||
|
||||
appendExtraWhere(ctx);
|
||||
|
||||
for (SqlTreeNode aChildren : children) {
|
||||
// recursively add to the where clause any
|
||||
// fixed predicates (extraWhere etc)
|
||||
aChildren.appendWhere(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
protected void appendExtraWhere(DbSqlContext ctx) {
|
||||
if (extraWhere != null) {
|
||||
if (ctx.length() > 0) {
|
||||
ctx.append(" and");
|
||||
@@ -526,12 +537,6 @@ class SqlTreeNodeBean implements SqlTreeNode {
|
||||
String ew = StringHelper.replaceString(extraWhere, "${ta}", ta);
|
||||
ctx.append(" ").append(ew).append(" ");
|
||||
}
|
||||
|
||||
for (SqlTreeNode aChildren : children) {
|
||||
// recursively add to the where clause any
|
||||
// fixed predicates (extraWhere etc)
|
||||
aChildren.appendWhere(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -612,7 +617,7 @@ class SqlTreeNodeBean implements SqlTreeNode {
|
||||
return sqlJoinType;
|
||||
}
|
||||
|
||||
private SqlJoinType appendFromAsJoin(DbSqlContext ctx, SqlJoinType joinType) {
|
||||
protected SqlJoinType appendFromAsJoin(DbSqlContext ctx, SqlJoinType joinType) {
|
||||
|
||||
if (nodeBeanProp instanceof STreePropertyAssocMany) {
|
||||
STreePropertyAssocMany manyProp = (STreePropertyAssocMany) nodeBeanProp;
|
||||
|
||||
@@ -41,6 +41,22 @@ final class SqlTreeNodeManyRoot extends SqlTreeNodeBean {
|
||||
return detailBean;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* append extraWhere to the join.
|
||||
*/
|
||||
@Override
|
||||
protected SqlJoinType appendFromAsJoin(DbSqlContext ctx, SqlJoinType joinType) {
|
||||
SqlJoinType join = super.appendFromAsJoin(ctx, joinType);
|
||||
super.appendExtraWhere(ctx);
|
||||
return join;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void appendExtraWhere(DbSqlContext ctx) {
|
||||
// extraWhere is already appended to the tableJoin
|
||||
}
|
||||
|
||||
/**
|
||||
* Force outer join for everything after the many property.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user