diff --git a/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanProperty.java b/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanProperty.java index 36da65454..768fe4224 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanProperty.java +++ b/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanProperty.java @@ -248,7 +248,7 @@ public class BeanProperty implements ElPropertyValue { this.secondaryTable = deploy.isSecondaryTable(); if (secondaryTable) { - this.secondaryTableJoin = new TableJoin(deploy.getSecondaryTableJoin(), null); + this.secondaryTableJoin = new TableJoin(deploy.getSecondaryTableJoin()); this.secondaryTableJoinPrefix = deploy.getSecondaryTableJoinPrefix(); } else { this.secondaryTableJoin = null; diff --git a/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanPropertyAssoc.java b/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanPropertyAssoc.java index 69bc64934..1e57fc07b 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanPropertyAssoc.java +++ b/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanPropertyAssoc.java @@ -80,7 +80,7 @@ public abstract class BeanPropertyAssoc extends BeanProperty { this.beanTable = deploy.getBeanTable(); this.mappedBy = InternString.intern(deploy.getMappedBy()); - this.tableJoin = new TableJoin(deploy.getTableJoin(), null); + this.tableJoin = new TableJoin(deploy.getTableJoin()); this.targetType = deploy.getTargetType(); this.cascadeInfo = deploy.getCascadeInfo(); diff --git a/src/main/java/com/avaje/ebeaninternal/server/deploy/TableJoin.java b/src/main/java/com/avaje/ebeaninternal/server/deploy/TableJoin.java index 5f3def61f..879105466 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/deploy/TableJoin.java +++ b/src/main/java/com/avaje/ebeaninternal/server/deploy/TableJoin.java @@ -28,11 +28,6 @@ public final class TableJoin { private final InheritInfo inheritInfo; - /** - * Properties as an array. - */ - private final BeanProperty[] properties; - /** * Columns as an array. */ @@ -46,7 +41,7 @@ public final class TableJoin { /** * Create a TableJoin. */ - public TableJoin(DeployTableJoin deploy, LinkedHashMap propMap) { + public TableJoin(DeployTableJoin deploy) { this.table = InternString.intern(deploy.getTable()); this.type = deploy.getType(); @@ -58,16 +53,6 @@ public final class TableJoin { this.columns[i] = new TableJoinColumn(deployCols[i]); } - DeployBeanProperty[] deployProps = deploy.properties(); - if (deployProps.length > 0 && propMap == null) { - throw new NullPointerException("propMap is null?"); - } - - this.properties = new BeanProperty[deployProps.length]; - for (int i = 0; i < deployProps.length; i++) { - BeanProperty prop = propMap.get(deployProps[i].getName()); - this.properties[i] = prop; - } this.queryHash = calcQueryHash(); } @@ -99,18 +84,6 @@ public final class TableJoin { return sb.toString(); } - public void appendSelect(DbSqlContext ctx, boolean subQuery) { - for (int i = 0, x = properties.length; i < x; i++) { - properties[i].appendSelect(ctx, subQuery); - } - } - - public void load(SqlBeanLoad sqlBeanLoad) throws SQLException { - for (int i = 0, x = properties.length; i < x; i++) { - properties[i].load(sqlBeanLoad); - } - } - /** * Return the join columns. */ @@ -118,13 +91,6 @@ public final class TableJoin { return columns; } - /** - * For secondary table joins returns the properties mapped to that table. - */ - public BeanProperty[] properties() { - return properties; - } - /** * Return the joined table name. */ diff --git a/src/main/java/com/avaje/ebeaninternal/server/deploy/meta/DeployBeanPropertyAssoc.java b/src/main/java/com/avaje/ebeaninternal/server/deploy/meta/DeployBeanPropertyAssoc.java index 7e80eb07c..4be1250fc 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/deploy/meta/DeployBeanPropertyAssoc.java +++ b/src/main/java/com/avaje/ebeaninternal/server/deploy/meta/DeployBeanPropertyAssoc.java @@ -77,13 +77,6 @@ public abstract class DeployBeanPropertyAssoc extends DeployBeanProperty { return isOuterJoin; } - /** - * Specify that this bean should use an outer join. - */ - public void setOuterJoin(boolean isOuterJoin) { - this.isOuterJoin = isOuterJoin; - } - /** * Return a literal expression that is added to the query that lazy loads * the collection. diff --git a/src/main/java/com/avaje/ebeaninternal/server/deploy/meta/DeployBeanPropertyAssocMany.java b/src/main/java/com/avaje/ebeaninternal/server/deploy/meta/DeployBeanPropertyAssocMany.java index 0fce29f55..57cf40d11 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/deploy/meta/DeployBeanPropertyAssocMany.java +++ b/src/main/java/com/avaje/ebeaninternal/server/deploy/meta/DeployBeanPropertyAssocMany.java @@ -115,7 +115,7 @@ public class DeployBeanPropertyAssocMany extends DeployBeanPropertyAssoc { */ public TableJoin createIntersectionTableJoin() { if (intersectionJoin != null){ - return new TableJoin(intersectionJoin, null); + return new TableJoin(intersectionJoin); } else { return null; } @@ -126,7 +126,7 @@ public class DeployBeanPropertyAssocMany extends DeployBeanPropertyAssoc { */ public TableJoin createInverseTableJoin() { if (inverseJoin != null){ - return new TableJoin(inverseJoin, null); + return new TableJoin(inverseJoin); } else { return null; } diff --git a/src/main/java/com/avaje/ebeaninternal/server/deploy/meta/DeployBeanPropertyAssocOne.java b/src/main/java/com/avaje/ebeaninternal/server/deploy/meta/DeployBeanPropertyAssocOne.java index dbf24a1a4..66d9ae892 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/deploy/meta/DeployBeanPropertyAssocOne.java +++ b/src/main/java/com/avaje/ebeaninternal/server/deploy/meta/DeployBeanPropertyAssocOne.java @@ -77,11 +77,4 @@ public class DeployBeanPropertyAssocOne extends DeployBeanPropertyAssoc { return importedPrimaryKey; } - /** - * Set to true if the bean maps to the primary key. - */ - public void setImportedPrimaryKey(boolean importedPrimaryKey) { - this.importedPrimaryKey = importedPrimaryKey; - } - } diff --git a/src/main/java/com/avaje/ebeaninternal/server/deploy/meta/DeployBeanPropertyLists.java b/src/main/java/com/avaje/ebeaninternal/server/deploy/meta/DeployBeanPropertyLists.java index c5234e7c7..dddd9e82b 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/deploy/meta/DeployBeanPropertyLists.java +++ b/src/main/java/com/avaje/ebeaninternal/server/deploy/meta/DeployBeanPropertyLists.java @@ -104,9 +104,8 @@ public class DeployBeanPropertyLists { List deployTableJoins = deploy.getTableJoins(); tableJoins = new TableJoin[deployTableJoins.size()]; for (int i = 0; i < deployTableJoins.size(); i++) { - tableJoins[i] = new TableJoin(deployTableJoins.get(i), propertyMap); + tableJoins[i] = new TableJoin(deployTableJoins.get(i)); } - } /** @@ -231,10 +230,6 @@ public class DeployBeanPropertyLists { return embedded.toArray(new BeanPropertyAssocOne[embedded.size()]); } - public BeanPropertyAssocOne[] getOneExported() { - return onesExported.toArray(new BeanPropertyAssocOne[onesExported.size()]); - } - public BeanPropertyAssocOne[] getOneImported() { return onesImported.toArray(new BeanPropertyAssocOne[onesImported.size()]); } diff --git a/src/main/java/com/avaje/ebeaninternal/server/deploy/meta/DeployTableJoin.java b/src/main/java/com/avaje/ebeaninternal/server/deploy/meta/DeployTableJoin.java index 7c325d11a..3b003acbd 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/deploy/meta/DeployTableJoin.java +++ b/src/main/java/com/avaje/ebeaninternal/server/deploy/meta/DeployTableJoin.java @@ -1,14 +1,12 @@ package com.avaje.ebeaninternal.server.deploy.meta; -import java.util.ArrayList; - -import javax.persistence.JoinColumn; - -import com.avaje.ebeaninternal.server.deploy.BeanCascadeInfo; import com.avaje.ebeaninternal.server.deploy.BeanTable; import com.avaje.ebeaninternal.server.deploy.InheritInfo; import com.avaje.ebeaninternal.server.query.SqlJoinType; +import javax.persistence.JoinColumn; +import java.util.ArrayList; + /** * Represents a join to another table during deployment phase. *

@@ -17,12 +15,6 @@ import com.avaje.ebeaninternal.server.query.SqlJoinType; */ public class DeployTableJoin { - /** - * Flag set when the imported key maps to the primary key. This occurs for intersection tables - * (ManyToMany). - */ - private boolean importedPrimaryKey; - /** * The joined table. */ @@ -33,21 +25,11 @@ public class DeployTableJoin { */ private SqlJoinType type = SqlJoinType.INNER; - /** - * The list of properties mapped to this joined table. - */ - private final ArrayList properties = new ArrayList(); - /** * The list of join column pairs. Used to generate the on clause. */ private ArrayList columns = new ArrayList(4); - /** - * The persist cascade info. - */ - private final BeanCascadeInfo cascadeInfo = new BeanCascadeInfo(); - private InheritInfo inheritInfo; /** @@ -60,21 +42,6 @@ public class DeployTableJoin { return type + " " + table + " " + columns; } - /** - * Return true if the imported foreign key maps to the primary key. - */ - public boolean isImportedPrimaryKey() { - return importedPrimaryKey; - } - - /** - * Flag set when the imported key maps to the primary key. This occurs for intersection tables - * (ManyToMany). - */ - public void setImportedPrimaryKey(boolean importedPrimaryKey) { - this.importedPrimaryKey = importedPrimaryKey; - } - /** * Return true if the JoinOnPair have been set. */ @@ -82,13 +49,6 @@ public class DeployTableJoin { return columns.size() > 0; } - /** - * Return the persist info. - */ - public BeanCascadeInfo getCascadeInfo() { - return cascadeInfo; - } - /** * Copy all the columns to this join potentially reversing the columns. */ @@ -138,13 +98,6 @@ public class DeployTableJoin { return columns.toArray(new DeployTableJoinColumn[columns.size()]); } - /** - * For secondary table joins returns the properties mapped to that table. - */ - public DeployBeanProperty[] properties() { - return properties.toArray(new DeployBeanProperty[properties.size()]); - } - /** * Return the joined table name. */ @@ -166,13 +119,6 @@ public class DeployTableJoin { return type; } - /** - * Return true if this join is a left outer join. - */ - public boolean isOuterJoin() { - return type == SqlJoinType.OUTER; - } - public void setType(SqlJoinType type) { this.type = type; } diff --git a/src/main/java/com/avaje/ebeaninternal/server/query/SqlTreeNodeBean.java b/src/main/java/com/avaje/ebeaninternal/server/query/SqlTreeNodeBean.java index 3a61e5acf..171b54096 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/query/SqlTreeNodeBean.java +++ b/src/main/java/com/avaje/ebeaninternal/server/query/SqlTreeNodeBean.java @@ -288,10 +288,6 @@ public class SqlTreeNodeBean implements SqlTreeNode { } } - for (int i = 0, x = tableJoins.length; i < x; i++) { - tableJoins[i].load(sqlBeanLoad); - } - boolean lazyLoadMany = false; if (localBean == null && queryMode.equals(Mode.LAZYLOAD_MANY)) { // batch lazy load many into existing contextBean @@ -406,7 +402,6 @@ public class SqlTreeNodeBean implements SqlTreeNode { appendSelect(ctx, false, idBinder.getBeanProperty()); } appendSelect(ctx, subQuery, properties); - appendSelectTableJoins(ctx); for (int i = 0; i < children.length; i++) { // read each child... and let them set their @@ -418,21 +413,6 @@ public class SqlTreeNodeBean implements SqlTreeNode { ctx.popJoin(); } - private void appendSelectTableJoins(DbSqlContext ctx) { - - String baseAlias = ctx.getTableAlias(prefix); - - for (int i = 0; i < tableJoins.length; i++) { - TableJoin join = tableJoins[i]; - - String alias = baseAlias + i; - - ctx.pushSecondaryTableAlias(alias); - join.appendSelect(ctx, false); - ctx.popTableAlias(); - } - } - /** * Append the properties to the buffer. */