diff --git a/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanDescriptor.java b/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanDescriptor.java index ccd212e8d..336c7d840 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanDescriptor.java +++ b/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanDescriptor.java @@ -104,18 +104,11 @@ public class BeanDescriptor implements MetaBeanInfo { private final boolean autoFetchTunable; - private final String lazyFetchIncludes; - /** * The concurrency mode for beans of this type. */ private final ConcurrencyMode concurrencyMode; - /** - * The tables this bean is dependent on. - */ - private final String[] dependantTables; - private final CompoundUniqueContraint[] compoundUniqueConstraints; /** @@ -339,11 +332,8 @@ public class BeanDescriptor implements MetaBeanInfo { this.sequenceInitialValue = deploy.getSequenceInitialValue(); this.sequenceAllocationSize = deploy.getSequenceAllocationSize(); this.selectLastInsertedId = deploy.getSelectLastInsertedId(); - this.lazyFetchIncludes = InternString.intern(deploy.getLazyFetchIncludes()); this.concurrencyMode = deploy.getConcurrencyMode(); this.updateChangesOnly = deploy.isUpdateChangesOnly(); - - this.dependantTables = deploy.getDependantTables(); this.compoundUniqueConstraints = deploy.getCompoundUniqueConstraints(); this.baseTable = InternString.intern(deploy.getBaseTable()); @@ -1534,14 +1524,6 @@ public class BeanDescriptor implements MetaBeanInfo { return EntityType.EMBEDDED.equals(entityType); } - /** - * Return the tables this bean is dependent on. This implies that if any of - * these tables are modified then cached beans may be invalidated. - */ - public String[] getDependantTables() { - return dependantTables; - } - /** * Return the compound unique constraints. */ @@ -1724,13 +1706,6 @@ public class BeanDescriptor implements MetaBeanInfo { return idGenerator; } - /** - * Return the includes for getReference(). - */ - public String getLazyFetchIncludes() { - return lazyFetchIncludes; - } - /** * Return the TableJoins. *

diff --git a/src/main/java/com/avaje/ebeaninternal/server/deploy/meta/DeployBeanDescriptor.java b/src/main/java/com/avaje/ebeaninternal/server/deploy/meta/DeployBeanDescriptor.java index 5aaf91fc4..348aac7bd 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/deploy/meta/DeployBeanDescriptor.java +++ b/src/main/java/com/avaje/ebeaninternal/server/deploy/meta/DeployBeanDescriptor.java @@ -1,23 +1,5 @@ package com.avaje.ebeaninternal.server.deploy.meta; -import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.persistence.Entity; -import javax.persistence.MappedSuperclass; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import com.avaje.ebean.annotation.ConcurrencyMode; import com.avaje.ebean.config.TableName; import com.avaje.ebean.config.dbplatform.IdGenerator; @@ -28,16 +10,14 @@ import com.avaje.ebean.event.BeanPersistListener; import com.avaje.ebean.event.BeanQueryAdapter; import com.avaje.ebeaninternal.server.core.CacheOptions; import com.avaje.ebeaninternal.server.deploy.BeanDescriptor.EntityType; -import com.avaje.ebeaninternal.server.deploy.ChainedBeanPersistController; -import com.avaje.ebeaninternal.server.deploy.ChainedBeanPersistListener; -import com.avaje.ebeaninternal.server.deploy.ChainedBeanQueryAdapter; -import com.avaje.ebeaninternal.server.deploy.CompoundUniqueContraint; -import com.avaje.ebeaninternal.server.deploy.DRawSqlMeta; -import com.avaje.ebeaninternal.server.deploy.DeployNamedQuery; -import com.avaje.ebeaninternal.server.deploy.DeployNamedUpdate; -import com.avaje.ebeaninternal.server.deploy.InheritInfo; +import com.avaje.ebeaninternal.server.deploy.*; import com.avaje.ebeaninternal.server.properties.BeanPropertyInfo; +import javax.persistence.Entity; +import javax.persistence.MappedSuperclass; +import java.lang.reflect.Modifier; +import java.util.*; + /** * Describes Beans including their deployment information. */ @@ -57,8 +37,6 @@ public class DeployBeanDescriptor { private static final String I_SCALAOBJECT = "scala.ScalaObject"; - private static final Logger logger = LoggerFactory.getLogger(DeployBeanDescriptor.class); - /** * Map of BeanProperty Linked so as to preserve order. */ @@ -100,8 +78,6 @@ public class DeployBeanDescriptor { */ private String selectLastInsertedId; - private String lazyFetchIncludes; - /** * The concurrency mode for beans of this type. */ @@ -109,11 +85,6 @@ public class DeployBeanDescriptor { private boolean updateChangesOnly; - /** - * The tables this bean is dependent on. - */ - private String[] dependantTables; - private List compoundUniqueConstraints; /** @@ -127,6 +98,7 @@ public class DeployBeanDescriptor { * faster than reflection at this stage. */ private BeanPropertyInfo beanReflect; + private String[] properties; /** @@ -289,10 +261,6 @@ public class DeployBeanDescriptor { this.properties = props; } - public BeanPropertyInfo getBeanReflect() { - return beanReflect; - } - /** * Return the class type this BeanDescriptor describes. */ @@ -330,10 +298,6 @@ public class DeployBeanDescriptor { return cacheOptions; } - public boolean isNaturalKeyProperty(String name) { - return name.equals(cacheOptions.getNaturalKey()); - } - public DeployBeanPropertyAssocOne getUnidirectional() { return unidirectional; } @@ -364,14 +328,6 @@ public class DeployBeanDescriptor { this.updateChangesOnly = updateChangesOnly; } - /** - * Return the tables this bean is dependant on. This implies that if any of - * these tables are modified then cached beans may be invalidated. - */ - public String[] getDependantTables() { - return dependantTables; - } - /** * Add a compound unique constraint. */ @@ -393,14 +349,6 @@ public class DeployBeanDescriptor { } } - /** - * Set the tables this bean is dependant on. This implies that if any of these - * tables are modified then cached beans may be invalidated. - */ - public void setDependantTables(String[] dependantTables) { - this.dependantTables = dependantTables; - } - /** * Return the beanFinder. Usually null unless overriding the finder. */ @@ -467,17 +415,6 @@ public class DeployBeanDescriptor { queryAdapters.add(queryAdapter); } - /** - * Return true if this bean type should use IdGeneration. - *

- * If this is false and the Id is null it is assumed that a database auto - * increment feature is being used to populate the id. - *

- */ - public boolean isUseIdGenerator() { - return idType == IdType.GENERATOR; - } - /** * Return the base table. Only properties mapped to the base table are by * default persisted. @@ -631,24 +568,6 @@ public class DeployBeanDescriptor { } } - /** - * Return the includes for getReference(). - */ - public String getLazyFetchIncludes() { - return lazyFetchIncludes; - } - - /** - * Set includes to use for lazy loading by getReference(). Note queries also - * build references and includes on the actual association are used for those - * references. - */ - public void setLazyFetchIncludes(String lazyFetchIncludes) { - if (lazyFetchIncludes != null && lazyFetchIncludes.length() > 0) { - this.lazyFetchIncludes = lazyFetchIncludes; - } - } - /** * Summary description. */ @@ -684,11 +603,7 @@ public class DeployBeanDescriptor { boolean hasLazyFetch = false; for (DeployBeanProperty prop : propMap.values()) { - if (prop.isTransient()) { - // ignore transient props etc - } else if (prop instanceof DeployBeanPropertyAssocMany) { - // ignore the associated many properties - } else { + if (!prop.isTransient() && !(prop instanceof DeployBeanPropertyAssocMany)) { if (prop.isFetchEager()) { sb.append(prop.getName()).append(","); } else { @@ -720,7 +635,7 @@ public class DeployBeanDescriptor { LinkedHashSet set = new LinkedHashSet(res.length + 3); - String temp = null; + String temp; for (int i = 0; i < res.length; i++) { temp = res[i].trim(); if (temp.length() > 0) { @@ -816,26 +731,6 @@ public class DeployBeanDescriptor { return list; } - /** - * Returns 'Version' properties on this bean. These are 'Counter' or 'Update - * Timestamp' type properties. Note version properties can also be on embedded - * beans rather than on the bean itself. - */ - public List propertiesVersion() { - - ArrayList list = new ArrayList(); - - for (DeployBeanProperty prop : propMap.values()) { - if (prop instanceof DeployBeanPropertyAssoc == false) { - if (!prop.isId() && prop.isVersionColumn()) { - list.add(prop); - } - } - } - - return list; - } - /** * base properties without the unique id properties. */ @@ -844,10 +739,8 @@ public class DeployBeanDescriptor { ArrayList list = new ArrayList(); for (DeployBeanProperty prop : propMap.values()) { - if (prop instanceof DeployBeanPropertyAssoc == false) { - if (!prop.isId()) { - list.add(prop); - } + if (!(prop instanceof DeployBeanPropertyAssoc) && !prop.isId()) { + list.add(prop); } }