mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-18 14:58:47 +00:00
Add fix and test for BUG 408 from Eddie
This commit is contained in:
1 parent
60a1a4bb5b
commit
9ad4931c12
13 files changed
+379
-5
No files matched your search
@@ -93,7 +93,7 @@ public class DefaultDbSqlContext implements DbSqlContext {
|
||||
joinStack.push(node);
|
||||
}
|
||||
|
||||
public void addJoin(String type, String table, TableJoinColumn[] cols, String a1, String a2) {
|
||||
public void addJoin(String type, String table, TableJoinColumn[] cols, String a1, String a2, String inheritance) {
|
||||
|
||||
if (tableJoins == null) {
|
||||
tableJoins = new HashSet<String>();
|
||||
@@ -125,6 +125,15 @@ public class DefaultDbSqlContext implements DbSqlContext {
|
||||
sb.append(".").append(pair.getLocalDbColumn());
|
||||
}
|
||||
|
||||
|
||||
// add on any inheritance where clause
|
||||
if (inheritance != null && inheritance.length() > 0){
|
||||
sb.append(" and ");
|
||||
sb.append(a2);
|
||||
sb.append(".");
|
||||
sb.append(inheritance);
|
||||
}
|
||||
|
||||
sb.append(" ");
|
||||
}
|
||||
|
||||
|
||||
@@ -423,7 +423,8 @@ public class SqlTreeNodeBean implements SqlTreeNode {
|
||||
|
||||
public void appendWhere(DbSqlContext ctx) {
|
||||
|
||||
if (inheritInfo != null) {
|
||||
// Only apply inheritance to root node as any join will alreay have the inheritance join include - see TableJoin
|
||||
if (inheritInfo != null && nodeBeanProp == null) {
|
||||
if (inheritInfo.isRoot()) {
|
||||
// at root of hierarchy so don't bother
|
||||
// adding a where clause because we want
|
||||
|
||||
Reference in new issue
Block a user