diff --git a/src/main/java/com/avaje/ebean/Query.java b/src/main/java/com/avaje/ebean/Query.java index 9473ddd57..fa7df252b 100644 --- a/src/main/java/com/avaje/ebean/Query.java +++ b/src/main/java/com/avaje/ebean/Query.java @@ -269,26 +269,6 @@ import java.util.Set; */ public interface Query extends Serializable { - /** - * How this query should use (or not) the Lucene Index if one is defined for - * the bean type. - */ - public enum UseIndex { - NO, DEFAULT, YES_IDS, YES_OBJECTS - } - - /** - * Explicitly specify how this query should use a Lucene Index if one is - * defined for this bean type. - */ - public Query setUseIndex(UseIndex useIndex); - - /** - * Return the setting for how this query should use a Lucene Index if one is - * defined for this bean type. - */ - public UseIndex getUseIndex(); - /** * Return the RawSql that was set to use for this query. */ @@ -1072,16 +1052,14 @@ public interface Query extends Serializable { */ public String getGeneratedSql(); - /** - * Return the total hits matched for a lucene text search query. - */ - public int getTotalHits(); - /** * executed the select with "for update" which should lock the record * "on read" */ public Query setForUpdate(boolean forUpdate); + /** + * Return true if this query has forUpdate set. + */ public boolean isForUpdate(); } diff --git a/src/main/java/com/avaje/ebean/Transaction.java b/src/main/java/com/avaje/ebean/Transaction.java index d7440ed3a..331cd8f1f 100644 --- a/src/main/java/com/avaje/ebean/Transaction.java +++ b/src/main/java/com/avaje/ebean/Transaction.java @@ -35,13 +35,6 @@ public interface Transaction extends Closeable { */ public static final int SERIALIZABLE = java.sql.Connection.TRANSACTION_SERIALIZABLE; - // /** - // * You can call this after the transaction commit to wait for any changes to - // * Lucene indexes to be made and committed. Note that generally this could - // * be some time so it is not expected that you call this method generally. - // */ - // public void waitForIndexUpdates(); - /** * Return true if this transaction is read only. */ diff --git a/src/main/java/com/avaje/ebean/annotation/CacheStrategy.java b/src/main/java/com/avaje/ebean/annotation/CacheStrategy.java index 8551a7bc9..240fcb411 100644 --- a/src/main/java/com/avaje/ebean/annotation/CacheStrategy.java +++ b/src/main/java/com/avaje/ebean/annotation/CacheStrategy.java @@ -6,7 +6,6 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import com.avaje.ebean.Query; -import com.avaje.ebean.Query.UseIndex; /** * Specify the default cache use specific entity type. @@ -56,9 +55,4 @@ public @interface CacheStrategy { */ String warmingQuery() default ""; - /** - * Default setting for using a text index if it has been defined on this bean - * type. - */ - UseIndex useIndex() default UseIndex.DEFAULT; }; diff --git a/src/main/java/com/avaje/ebeaninternal/api/SpiQuery.java b/src/main/java/com/avaje/ebeaninternal/api/SpiQuery.java index ffe64902a..792e80beb 100644 --- a/src/main/java/com/avaje/ebeaninternal/api/SpiQuery.java +++ b/src/main/java/com/avaje/ebeaninternal/api/SpiQuery.java @@ -80,11 +80,6 @@ public interface SpiQuery extends Query { */ SUBQUERY } - - /** - * Set total hits when querying against lucene. - */ - public void setTotalHits(int totalHits); /** * Return true if select all properties was used to ensure the property diff --git a/src/main/java/com/avaje/ebeaninternal/server/core/DefaultServer.java b/src/main/java/com/avaje/ebeaninternal/server/core/DefaultServer.java index da9e7e25b..63fdfafc0 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/core/DefaultServer.java +++ b/src/main/java/com/avaje/ebeaninternal/server/core/DefaultServer.java @@ -490,7 +490,7 @@ public final class DefaultServer implements SpiEbeanServer { } /** - * Compile a query. Only valid for ORM queries (not LDAP) + * Compile a query. Only valid for ORM queries. */ public CQuery compileQuery(Query query, Transaction t) { SpiOrmQueryRequest qr = createQueryRequest(Type.SUBQUERY, query, t); diff --git a/src/main/java/com/avaje/ebeaninternal/server/core/OrmQueryRequest.java b/src/main/java/com/avaje/ebeaninternal/server/core/OrmQueryRequest.java index 690f50bca..e01896b93 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/core/OrmQueryRequest.java +++ b/src/main/java/com/avaje/ebeaninternal/server/core/OrmQueryRequest.java @@ -80,10 +80,6 @@ public final class OrmQueryRequest extends BeanRequest implements BeanQueryRe graphContext.registerSecondaryQueries(query); } - public void setTotalHits(int totalHits) { - query.setTotalHits(totalHits); - } - public void executeSecondaryQueries(int defaultQueryBatch) { graphContext.executeSecondaryQueries(this, defaultQueryBatch); } 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 f27a2d019..7e0ce4b6a 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanDescriptor.java +++ b/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanDescriptor.java @@ -19,7 +19,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.avaje.ebean.Query; -import com.avaje.ebean.Query.UseIndex; import com.avaje.ebean.SqlUpdate; import com.avaje.ebean.Transaction; import com.avaje.ebean.annotation.ConcurrencyMode; @@ -106,7 +105,7 @@ public class BeanDescriptor implements MetaBeanInfo { private final String serverName; /** - * Set to true if this is a LDAP domain object. + * The nature/type of this bean. */ private final EntityType entityType; @@ -346,12 +345,9 @@ public class BeanDescriptor implements MetaBeanInfo { private final String defaultSelectClause; private final Set defaultSelectClauseSet; - private final String[] defaultSelectDbArray; private final String descriptorId; - private final UseIndex useIndex; - private SpiEbeanServer ebeanServer; private ServerCache beanCache; @@ -372,7 +368,6 @@ public class BeanDescriptor implements MetaBeanInfo { this.fullName = InternString.intern(deploy.getFullName()); this.descriptorId = descriptorId; - this.useIndex = deploy.getUseIndex(); this.typeManager = typeManager; this.beanType = deploy.getBeanType(); this.factoryType = deploy.getFactoryType(); @@ -390,7 +385,6 @@ public class BeanDescriptor implements MetaBeanInfo { this.defaultSelectClause = deploy.getDefaultSelectClause(); this.defaultSelectClauseSet = deploy.parseDefaultSelectClause(defaultSelectClause); - this.defaultSelectDbArray = deploy.getDefaultSelectDbArray(defaultSelectClauseSet); this.idType = deploy.getIdType(); this.idGenerator = deploy.getIdGenerator(); @@ -569,14 +563,6 @@ public class BeanDescriptor implements MetaBeanInfo { return entityType; } - /** - * Return the default strategy for using a lucene index (if an index is - * defined on this bean type). - */ - public UseIndex getUseIndex() { - return useIndex; - } - /** * Initialise the Id properties first. *

@@ -808,13 +794,6 @@ public class BeanDescriptor implements MetaBeanInfo { return defaultSelectClauseSet; } - /** - * For LDAP return array of (DB) attributes to include in query by default. - */ - public String[] getDefaultSelectDbArray() { - return defaultSelectDbArray; - } - /** * Return true if this object is the root level object in its entity * inheritance. @@ -858,8 +837,7 @@ public class BeanDescriptor implements MetaBeanInfo { } /** - * Return true if there is L2 caching (Lucene or Bean cache) for this bean - * type. + * Return true if there is L2 bean caching for this bean type. */ public boolean isUsingL2Cache() { return isBeanCaching(); 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 53dfd4220..a69ffc731 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanProperty.java +++ b/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanProperty.java @@ -1049,19 +1049,6 @@ public class BeanProperty implements ElPropertyValue { return value; } -// private ArrayList luceneIndexes; -// -// public void registerLuceneIndex(LuceneIndex luceneIndex) { -// if (luceneIndexes == null) { -// luceneIndexes = new ArrayList(); -// } -// luceneIndexes.add(luceneIndex); -// } -// -// public boolean isDeltaRequired() { -// return true;//luceneIndexes != null; -// } - /** * Return true if by default this property is set to fetch eager. * Lob's usually default to fetch lazy. diff --git a/src/main/java/com/avaje/ebeaninternal/server/deploy/id/IdBinder.java b/src/main/java/com/avaje/ebeaninternal/server/deploy/id/IdBinder.java index f2416b483..15db38a57 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/deploy/id/IdBinder.java +++ b/src/main/java/com/avaje/ebeaninternal/server/deploy/id/IdBinder.java @@ -6,9 +6,6 @@ import java.io.IOException; import java.sql.SQLException; import java.util.List; -import javax.naming.InvalidNameException; -import javax.naming.ldap.LdapName; - import com.avaje.ebeaninternal.api.SpiExpressionRequest; import com.avaje.ebeaninternal.server.core.DefaultSqlUpdate; import com.avaje.ebeaninternal.server.deploy.BeanProperty; @@ -21,172 +18,156 @@ import com.avaje.ebeaninternal.server.type.DataBind; */ public interface IdBinder { - /** - * Initialise the binder. - */ - public void initialise(); - - /** - * Convert the Id value as a Lucene string term. - */ - public String writeTerm(Object idValue); + /** + * Initialise the binder. + */ + public void initialise(); - /** - * Convert the Lucene string term into an Id value. - */ - public Object readTerm(String idTermValue); + /** + * Write the Id value to binary DataOuput. + */ + public void writeData(DataOutput dataOutput, Object idValue) throws IOException; - /** - * Write the Id value to binary DataOuput. - */ - public void writeData(DataOutput dataOutput, Object idValue) throws IOException; + /** + * Read the Id value from the binary DataInput. + */ + public Object readData(DataInput dataInput) throws IOException; - /** - * Read the Id value from the binary DataInput. - */ - public Object readData(DataInput dataInput) throws IOException; + /** + * Return the name(s) of the Id property(s). Comma delimited if there is more + * than one. + *

+ * This can be used to include in a query. + *

+ */ + public String getIdProperty(); - /** - * Adds RDN's to the LdapName using the id value. - */ - public void createLdapNameById(LdapName name, Object id) throws InvalidNameException; + /** + * Find a BeanProperty that is mapped to the database column. + */ + public BeanProperty findBeanProperty(String dbColumnName); - /** - * Adds RDN's to the LdapName using the id value from the bean. - */ - public void createLdapNameByBean(LdapName name, Object bean) throws InvalidNameException; + /** + * Return the number of scalar properties for this id. + */ + public int getPropertyCount(); - /** - * Return the name(s) of the Id property(s). - * Comma delimited if there is more than one. - *

- * This can be used to include in a query. - *

- */ - public String getIdProperty(); + /** + * Return false if the id is a simple scalar and false if it is embedded or + * concatenated. + */ + public boolean isComplexId(); - /** - * Find a BeanProperty that is mapped to the database column. - */ - public BeanProperty findBeanProperty(String dbColumnName); - - /** - * Return the number of scalar properties for this id. - */ - public int getPropertyCount(); - - /** - * Return false if the id is a simple scalar and false if it is embedded or concatenated. - */ - public boolean isComplexId(); - - /** - * Return the default order by that may need to be used if the query includes a many property. - */ - public String getDefaultOrderBy(); - - public String getOrderBy(String pathPrefix, boolean ascending); - - /** - * Return the values as an array of scalar bindable values. - *

- * For concatenated keys that use an Embedded bean or multiple id properties - * this determines the field values are returns them as an Object array. - *

- *

- * Added primarily for Query.addWhere().add(Expr.idEq()) support. - *

- */ - public Object[] getBindValues(Object idValue); - - /** - * Return the id values for a given bean. - */ - public Object[] getIdValues(Object bean); - - /** - * Build a string of the logical expressions. - *

- * Typically used to build a id = ? string. - *

- */ - public String getAssocOneIdExpr(String prefix, String operator); - - /** - * Return the logical id in expression taking into account embedded id's. - */ - public String getAssocIdInExpr(String prefix); + /** + * Return the default order by that may need to be used if the query includes + * a many property. + */ + public String getDefaultOrderBy(); - /** - * Binds an id value to a prepared statement. - */ - public void bindId(DataBind dataBind, Object value) throws SQLException; + public String getOrderBy(String pathPrefix, boolean ascending); - /** - * Bind the id value to a SqlUpdate statement. - */ - public void bindId(DefaultSqlUpdate sqlUpdate, Object value); - - public void addIdInBindValue(SpiExpressionRequest request, Object value); - - /** - * Return the sql for binding the id using an IN clause. - */ - public String getBindIdInSql(String baseTableAlias); - - /** - * Return the binding expression (like "?" or "(?,?)")for the Id. - */ - public String getIdInValueExpr(int size); - - /** - * Same as getIdInValueExpr but for delete by id. - */ - public String getIdInValueExprDelete(int size); - - public void buildSelectExpressionChain(String prefix, List selectChain); - - /** - * Read the id value from the result set and set it to the bean also returning it. - */ - public Object readSet(DbReadContext ctx, Object bean) throws SQLException; + /** + * Return the values as an array of scalar bindable values. + *

+ * For concatenated keys that use an Embedded bean or multiple id properties + * this determines the field values are returns them as an Object array. + *

+ *

+ * Added primarily for Query.addWhere().add(Expr.idEq()) support. + *

+ */ + public Object[] getBindValues(Object idValue); - /** - * Ignore the appropriate number of scalar properties for this id. - */ - public void loadIgnore(DbReadContext ctx); - - /** - * Read the id value from the result set and return it. - */ - public Object read(DbReadContext ctx) throws SQLException; + /** + * Return the id values for a given bean. + */ + public Object[] getIdValues(Object bean); - /** - * Append to the select clause. - */ - public void appendSelect(DbSqlContext ctx, boolean subQuery); - - /** - * Return the sql for binding the id to. This includes table alias and columns that make up the id. - */ - public String getBindIdSql(String baseTableAlias); - - /** - * Return the id properties in flat form. - */ - public BeanProperty[] getProperties(); - - /** - * Cast or convert the Id value if necessary and optionally set it. - *

- * The Id value is not assumed to be the correct type so it is converted to - * the correct type. Typically this is because we could get a Integer, Long - * or BigDecimal depending on the JDBC driver and situation. - *

- *

- * If the bean is not null, then the value is set to the bean. - *

- */ - public Object convertSetId(Object idValue, Object bean); + /** + * Build a string of the logical expressions. + *

+ * Typically used to build a id = ? string. + *

+ */ + public String getAssocOneIdExpr(String prefix, String operator); + + /** + * Return the logical id in expression taking into account embedded id's. + */ + public String getAssocIdInExpr(String prefix); + + /** + * Binds an id value to a prepared statement. + */ + public void bindId(DataBind dataBind, Object value) throws SQLException; + + /** + * Bind the id value to a SqlUpdate statement. + */ + public void bindId(DefaultSqlUpdate sqlUpdate, Object value); + + public void addIdInBindValue(SpiExpressionRequest request, Object value); + + /** + * Return the sql for binding the id using an IN clause. + */ + public String getBindIdInSql(String baseTableAlias); + + /** + * Return the binding expression (like "?" or "(?,?)")for the Id. + */ + public String getIdInValueExpr(int size); + + /** + * Same as getIdInValueExpr but for delete by id. + */ + public String getIdInValueExprDelete(int size); + + public void buildSelectExpressionChain(String prefix, List selectChain); + + /** + * Read the id value from the result set and set it to the bean also returning + * it. + */ + public Object readSet(DbReadContext ctx, Object bean) throws SQLException; + + /** + * Ignore the appropriate number of scalar properties for this id. + */ + public void loadIgnore(DbReadContext ctx); + + /** + * Read the id value from the result set and return it. + */ + public Object read(DbReadContext ctx) throws SQLException; + + /** + * Append to the select clause. + */ + public void appendSelect(DbSqlContext ctx, boolean subQuery); + + /** + * Return the sql for binding the id to. This includes table alias and columns + * that make up the id. + */ + public String getBindIdSql(String baseTableAlias); + + /** + * Return the id properties in flat form. + */ + public BeanProperty[] getProperties(); + + /** + * Cast or convert the Id value if necessary and optionally set it. + *

+ * The Id value is not assumed to be the correct type so it is converted to + * the correct type. Typically this is because we could get a Integer, Long or + * BigDecimal depending on the JDBC driver and situation. + *

+ *

+ * If the bean is not null, then the value is set to the bean. + *

+ */ + public Object convertSetId(Object idValue, Object bean); } diff --git a/src/main/java/com/avaje/ebeaninternal/server/deploy/id/IdBinderEmbedded.java b/src/main/java/com/avaje/ebeaninternal/server/deploy/id/IdBinderEmbedded.java index 59a7446b4..c1f2e26c2 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/deploy/id/IdBinderEmbedded.java +++ b/src/main/java/com/avaje/ebeaninternal/server/deploy/id/IdBinderEmbedded.java @@ -6,11 +6,6 @@ import java.io.IOException; import java.sql.SQLException; import java.util.List; -import javax.naming.InvalidNameException; -import javax.naming.ldap.LdapName; -import javax.naming.ldap.Rdn; -import javax.persistence.PersistenceException; - import com.avaje.ebeaninternal.api.SpiExpressionRequest; import com.avaje.ebeaninternal.server.core.DefaultSqlUpdate; import com.avaje.ebeaninternal.server.deploy.BeanDescriptor; @@ -99,23 +94,6 @@ public final class IdBinderEmbedded implements IdBinder { return sb.toString(); } - - public void createLdapNameById(LdapName name, Object id) throws InvalidNameException { - - for (int i = 0; i < props.length; i++) { - Object v = props[i].getValue(id); - Rdn rdn = new Rdn(props[i].getDbColumn(), v); - name.add(rdn); - } - } - - - - public void createLdapNameByBean(LdapName name, Object bean) throws InvalidNameException { - Object id = embIdProperty.getValue(bean); - createLdapNameById(name, id); - } - public BeanDescriptor getIdBeanDescriptor() { return idDesc; } @@ -228,42 +206,6 @@ public final class IdBinderEmbedded implements IdBinder { return idInValueSql; } - /** - * Convert the lucene string term value into embedded id. - */ - public Object readTerm(String idTermValue) { - - String[] split = idTermValue.split("|"); - if (split.length != props.length){ - String msg = "Failed to split ["+idTermValue+"] using | for id."; - throw new PersistenceException(msg); - } - Object embId = idDesc.createBean(); - for (int i = 0; i < props.length; i++) { - Object v = props[i].getScalarType().parse(split[i]); - props[i].setValue(embId, v); - } - return embId; - } - - /** - * Write the embedded id as a Lucene string term value. - */ - public String writeTerm(Object idValue) { - - StringBuilder sb = new StringBuilder(); - - for (int i = 0; i < props.length; i++) { - Object v = props[i].getValue(idValue); - String formatValue = props[i].getScalarType().format(v); - if (i > 0){ - sb.append("|"); - } - sb.append(formatValue); - } - return sb.toString(); - } - public Object[] getIdValues(Object bean) { bean = embIdProperty.getValue(bean); Object[] bindvalues = new Object[props.length]; diff --git a/src/main/java/com/avaje/ebeaninternal/server/deploy/id/IdBinderEmpty.java b/src/main/java/com/avaje/ebeaninternal/server/deploy/id/IdBinderEmpty.java index 66037273e..d9bb51814 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/deploy/id/IdBinderEmpty.java +++ b/src/main/java/com/avaje/ebeaninternal/server/deploy/id/IdBinderEmpty.java @@ -6,9 +6,6 @@ import java.io.IOException; import java.sql.SQLException; import java.util.List; -import javax.naming.InvalidNameException; -import javax.naming.ldap.LdapName; - import com.avaje.ebeaninternal.api.SpiExpressionRequest; import com.avaje.ebeaninternal.server.core.DefaultSqlUpdate; import com.avaje.ebeaninternal.server.deploy.BeanProperty; @@ -21,132 +18,118 @@ import com.avaje.ebeaninternal.server.type.DataBind; */ public final class IdBinderEmpty implements IdBinder { - private static final String bindIdSql = ""; - - private static final BeanProperty[] properties = new BeanProperty[0]; - - public IdBinderEmpty() { + private static final String bindIdSql = ""; - } - public void initialise(){ - - } - - public Object readTerm(String idTermValue) { - return null; - } - - public String writeTerm(Object idValue) { - return null; - } - - public String getOrderBy(String pathPrefix, boolean ascending){ - return pathPrefix; - } - - public void buildSelectExpressionChain(String prefix, List selectChain) { - } - - public void createLdapNameById(LdapName name, Object id) throws InvalidNameException { - } - - public void createLdapNameByBean(LdapName name, Object bean) throws InvalidNameException { - } - - public int getPropertyCount() { - return 0; - } - - public String getIdProperty() { - return null; - } + private static final BeanProperty[] properties = new BeanProperty[0]; - public BeanProperty findBeanProperty(String dbColumnName) { - return null; - } - public boolean isComplexId(){ - return true; - } + public IdBinderEmpty() { + } - public String getDefaultOrderBy() { - // this should never happen? - return ""; - } - - public BeanProperty[] getProperties() { - return properties; - } + public void initialise() { - public String getBindIdSql(String baseTableAlias) { - return bindIdSql; - } - - public String getAssocOneIdExpr(String prefix, String operator){ - return null; - } - - public String getAssocIdInExpr(String prefix) { - return null; - } - - public void addIdInBindValue(SpiExpressionRequest request, Object value) { - - } - - public String getIdInValueExprDelete(int size) { - return getIdInValueExpr(size); - } - - public String getIdInValueExpr(int size) { - return ""; - } + } - - public String getBindIdInSql(String baseTableAlias) { - return null; - } - - public Object[] getIdValues(Object bean){ - return null; - } - - public Object[] getBindValues(Object idValue){ - return new Object[]{idValue}; - } - - public void bindId(DefaultSqlUpdate sqlUpdate, Object value) { - - } - - public void bindId(DataBind dataBind, Object value) throws SQLException { - - } - - public void loadIgnore(DbReadContext ctx) { - } + public String getOrderBy(String pathPrefix, boolean ascending) { + return pathPrefix; + } + + public void buildSelectExpressionChain(String prefix, List selectChain) { + } + + public int getPropertyCount() { + return 0; + } + + public String getIdProperty() { + return null; + } + + public BeanProperty findBeanProperty(String dbColumnName) { + return null; + } + + public boolean isComplexId() { + return true; + } + + public String getDefaultOrderBy() { + // this should never happen? + return ""; + } + + public BeanProperty[] getProperties() { + return properties; + } + + public String getBindIdSql(String baseTableAlias) { + return bindIdSql; + } + + public String getAssocOneIdExpr(String prefix, String operator) { + return null; + } + + public String getAssocIdInExpr(String prefix) { + return null; + } + + public void addIdInBindValue(SpiExpressionRequest request, Object value) { + + } + + public String getIdInValueExprDelete(int size) { + return getIdInValueExpr(size); + } + + public String getIdInValueExpr(int size) { + return ""; + } + + public String getBindIdInSql(String baseTableAlias) { + return null; + } + + public Object[] getIdValues(Object bean) { + return null; + } + + public Object[] getBindValues(Object idValue) { + return new Object[] { idValue }; + } + + public void bindId(DefaultSqlUpdate sqlUpdate, Object value) { + + } + + public void bindId(DataBind dataBind, Object value) throws SQLException { + + } + + public void loadIgnore(DbReadContext ctx) { + } + + public Object readSet(DbReadContext ctx, Object bean) throws SQLException { + return null; + } + + public Object read(DbReadContext ctx) throws SQLException { + return null; + } + + public void appendSelect(DbSqlContext ctx, boolean subQuery) { + } + + public Object convertSetId(Object idValue, Object bean) { + return idValue; + } + + public Object readData(DataInput dataOutput) throws IOException { + return null; + } + + public void writeData(DataOutput dataOutput, Object idValue) throws IOException { + + } - public Object readSet(DbReadContext ctx, Object bean) throws SQLException { - return null; - } - - public Object read(DbReadContext ctx) throws SQLException { - return null; - } - - public void appendSelect(DbSqlContext ctx, boolean subQuery) { - } - - public Object convertSetId(Object idValue, Object bean){ - return idValue; - } - - public Object readData(DataInput dataOutput) throws IOException { - return null; - } - - public void writeData(DataOutput dataOutput, Object idValue) throws IOException { - - } - } diff --git a/src/main/java/com/avaje/ebeaninternal/server/deploy/id/IdBinderMultiple.java b/src/main/java/com/avaje/ebeaninternal/server/deploy/id/IdBinderMultiple.java index 7f368196e..2cea5f334 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/deploy/id/IdBinderMultiple.java +++ b/src/main/java/com/avaje/ebeaninternal/server/deploy/id/IdBinderMultiple.java @@ -8,9 +8,6 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import javax.naming.InvalidNameException; -import javax.naming.ldap.LdapName; -import javax.naming.ldap.Rdn; import javax.persistence.PersistenceException; import com.avaje.ebeaninternal.api.SpiExpressionRequest; @@ -83,24 +80,6 @@ public final class IdBinderMultiple implements IdBinder { return sb.toString(); } - public void createLdapNameById(LdapName name, Object id) throws InvalidNameException { - - if (id instanceof Map == false){ - throw new RuntimeException("Expecting a Map for concatinated key"); - } - - Map mapId = (Map)id; - for (int i = 0; i < props.length; i++) { - - Object v = mapId.get(props[i].getName()); - if (v == null){ - throw new RuntimeException("No value in Map for key "+props[i].getName()); - } - - Rdn rdn = new Rdn(props[i].getDbColumn(), v); - name.add(rdn); - } - } public void buildSelectExpressionChain(String prefix, List selectChain) { @@ -109,19 +88,11 @@ public final class IdBinderMultiple implements IdBinder { } } - public void createLdapNameByBean(LdapName name, Object bean) throws InvalidNameException { - for (int i = 0; i < props.length; i++) { - - Object v = props[i].getValue(bean); - Rdn rdn = new Rdn(props[i].getDbColumn(), v); - name.add(rdn); - } - } - public int getPropertyCount() { - return props.length; - } + public int getPropertyCount() { + return props.length; + } public String getIdProperty() { return idProperties; @@ -229,40 +200,6 @@ public final class IdBinderMultiple implements IdBinder { } } - - public Object readTerm(String idTermValue) { - - String[] split = idTermValue.split("|"); - if (split.length != props.length){ - String msg = "Failed to split ["+idTermValue+"] using | for id."; - throw new PersistenceException(msg); - } - Map uidMap = new LinkedHashMap(); - for (int i = 0; i < props.length; i++) { - Object v = props[i].getScalarType().parse(split[i]); - uidMap.put(props[i].getName(), v); - } - return uidMap; - } - - @SuppressWarnings("unchecked") - public String writeTerm(Object idValue) { - - Map uidMap = (Map) idValue; - - StringBuilder sb = new StringBuilder(); - - for (int i = 0; i < props.length; i++) { - Object v = uidMap.get(props[i].getName()); - String formatValue = props[i].getScalarType().format(v); - if (i > 0){ - sb.append("|"); - } - sb.append(formatValue); - } - return sb.toString(); - } - public Object readData(DataInput dataInput) throws IOException { LinkedHashMap map = new LinkedHashMap(); diff --git a/src/main/java/com/avaje/ebeaninternal/server/deploy/id/IdBinderSimple.java b/src/main/java/com/avaje/ebeaninternal/server/deploy/id/IdBinderSimple.java index 3e3823888..28847dc59 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/deploy/id/IdBinderSimple.java +++ b/src/main/java/com/avaje/ebeaninternal/server/deploy/id/IdBinderSimple.java @@ -6,10 +6,6 @@ import java.io.IOException; import java.sql.SQLException; import java.util.List; -import javax.naming.InvalidNameException; -import javax.naming.ldap.LdapName; -import javax.naming.ldap.Rdn; - import com.avaje.ebeaninternal.api.SpiExpressionRequest; import com.avaje.ebeaninternal.server.core.DefaultSqlUpdate; import com.avaje.ebeaninternal.server.core.InternString; @@ -48,14 +44,6 @@ public final class IdBinderSimple implements IdBinder { // do nothing } - public Object readTerm(String idTermValue) { - return scalarType.parse(idTermValue); - } - - public String writeTerm(Object idValue) { - return scalarType.format(idValue); - } - public String getOrderBy(String pathPrefix, boolean ascending){ StringBuilder sb = new StringBuilder(); @@ -73,16 +61,6 @@ public final class IdBinderSimple implements IdBinder { idProperty.buildSelectExpressionChain(prefix, selectChain); } - - public void createLdapNameById(LdapName name, Object id) throws InvalidNameException { - Rdn rdn = new Rdn(idProperty.getDbColumn(), id); - name.add(rdn); - } - - public void createLdapNameByBean(LdapName name, Object bean) throws InvalidNameException { - Object id = idProperty.getValue(bean); - createLdapNameById(name, id); - } /** * Returns 1. 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 4c571a1b1..114d3f729 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 @@ -16,7 +16,6 @@ import java.util.Set; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.avaje.ebean.Query.UseIndex; import com.avaje.ebean.annotation.ConcurrencyMode; import com.avaje.ebean.config.TableName; import com.avaje.ebean.config.dbplatform.IdGenerator; @@ -149,8 +148,6 @@ public class DeployBeanDescriptor { */ private BeanFinder beanFinder; - private UseIndex useIndex; - /** * The table joins for this bean. Server side only. */ @@ -179,20 +176,6 @@ public class DeployBeanDescriptor { return Modifier.isAbstract(beanType.getModifiers()); } - /** - * Return the default UseIndex strategy. - */ - public UseIndex getUseIndex() { - return useIndex; - } - - /** - * Set the default UseIndex strategy. - */ - public void setUseIndex(UseIndex useIndex) { - this.useIndex = useIndex; - } - public boolean isScalaObject() { Class[] interfaces = beanType.getInterfaces(); for (int i = 0; i < interfaces.length; i++) { @@ -772,26 +755,6 @@ public class DeployBeanDescriptor { return selectClause.substring(0, selectClause.length() - 1); } - /** - * Return an Array of properties to include in default fetch (for LDAP). - */ - public String[] getDefaultSelectDbArray(Set defaultSelect) { - - ArrayList list = new ArrayList(); - for (DeployBeanProperty p : propMap.values()) { - if (defaultSelect != null) { - if (defaultSelect.contains(p.getName())) { - // properties in defaultSelect - list.add(p.getDbColumn()); - } - } else if (!p.isTransient() && p.isDbRead()) { - // non transient db properties - list.add(p.getDbColumn()); - } - } - return list.toArray(new String[list.size()]); - } - /** * Parse the include separating by comma or semicolon. */ diff --git a/src/main/java/com/avaje/ebeaninternal/server/deploy/parse/AnnotationClass.java b/src/main/java/com/avaje/ebeaninternal/server/deploy/parse/AnnotationClass.java index 14bb5a66f..a9035b1d1 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/deploy/parse/AnnotationClass.java +++ b/src/main/java/com/avaje/ebeaninternal/server/deploy/parse/AnnotationClass.java @@ -7,7 +7,6 @@ import javax.persistence.NamedQuery; import javax.persistence.Table; import javax.persistence.UniqueConstraint; -import com.avaje.ebean.Query.UseIndex; import com.avaje.ebean.annotation.CacheStrategy; import com.avaje.ebean.annotation.EntityConcurrencyMode; import com.avaje.ebean.annotation.NamedUpdate; @@ -135,11 +134,6 @@ public class AnnotationClass extends AnnotationParser { cacheOptions.setNaturalKey(propName); } } - - if (!UseIndex.DEFAULT.equals(cacheStrategy.useIndex())) { - // a specific text index strategy has been defined - descriptor.setUseIndex(cacheStrategy.useIndex()); - } } private void readNamedQueries(NamedQueries namedQueries) { diff --git a/src/main/java/com/avaje/ebeaninternal/server/persist/DefaultPersister.java b/src/main/java/com/avaje/ebeaninternal/server/persist/DefaultPersister.java index 52e434c00..ae466210d 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/persist/DefaultPersister.java +++ b/src/main/java/com/avaje/ebeaninternal/server/persist/DefaultPersister.java @@ -72,17 +72,11 @@ public final class DefaultPersister implements Persister { private final BeanDescriptorManager beanDescriptorManager; -// private final boolean defaultUpdateNullProperties; -// private final boolean defaultDeleteMissingChildren; - public DefaultPersister(SpiEbeanServer server, Binder binder, BeanDescriptorManager descMgr, PstmtBatch pstmtBatch) { this.server = server; this.beanDescriptorManager = descMgr; this.persistExecute = new DefaultPersistExecute(binder, pstmtBatch); - -// this.defaultUpdateNullProperties = server.isDefaultUpdateNullProperties(); -// this.defaultDeleteMissingChildren = server.isDefaultDeleteMissingChildren(); } /** @@ -508,7 +502,7 @@ public final class DefaultPersister implements Persister { SqlUpdate sqlDelete = manys[i].deleteByParentId(id, idList); executeSqlUpdate(sqlDelete, t); } else { - // we need to fetch the Id's to delete (recurse or notify L2 cache/lucene) + // we need to fetch the Id's to delete (recurse or notify L2 cache) List childIds = manys[i].findIdsByParentId(id, idList, t, null); if (!childIds.isEmpty()) { delete(targetDesc, null, childIds, t); diff --git a/src/main/java/com/avaje/ebeaninternal/server/querydefn/DefaultOrmQuery.java b/src/main/java/com/avaje/ebeaninternal/server/querydefn/DefaultOrmQuery.java index 4804fca1d..99ceb508e 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/querydefn/DefaultOrmQuery.java +++ b/src/main/java/com/avaje/ebeaninternal/server/querydefn/DefaultOrmQuery.java @@ -89,9 +89,7 @@ public class DefaultOrmQuery implements SpiQuery { * The name of the query. */ private String name; - - private UseIndex useIndex; - + private Type type; private Mode mode = Mode.NORMAL; @@ -484,18 +482,9 @@ public class DefaultOrmQuery implements SpiQuery { this.type = type; } - public UseIndex getUseIndex() { - return useIndex; - } - - public DefaultOrmQuery setUseIndex(UseIndex useIndex) { - this.useIndex = useIndex; - return this; - } - - public String getLoadDescription() { - return loadDescription; - } + public String getLoadDescription() { + return loadDescription; + } public String getLoadMode() { return loadMode; @@ -652,7 +641,7 @@ public class DefaultOrmQuery implements SpiQuery { } builder.add((type == null ? 0 : type.ordinal()+1)); - builder.add(useIndex).add(autoFetchTuned).add(distinct).add(query); + builder.add(autoFetchTuned).add(distinct).add(query); builder.add(firstRow).add(maxRows).add(orderBy).add(forUpdate); builder.add(rawWhereClause).add(additionalWhere).add(additionalHaving); builder.add(mapKey); diff --git a/src/main/java/com/avaje/ebeaninternal/server/transaction/DeleteByIdMap.java b/src/main/java/com/avaje/ebeaninternal/server/transaction/DeleteByIdMap.java index c6f036be3..8a7b9f7d7 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/transaction/DeleteByIdMap.java +++ b/src/main/java/com/avaje/ebeaninternal/server/transaction/DeleteByIdMap.java @@ -10,7 +10,7 @@ import com.avaje.ebeaninternal.server.core.PersistRequest; import com.avaje.ebeaninternal.server.deploy.BeanDescriptor; /** - * Beans deleted by Id used for updating L2 Cache and Lucene indexes. + * Beans deleted by Id used for updating L2 Cache. */ public final class DeleteByIdMap { diff --git a/src/main/java/com/avaje/ebeaninternal/server/transaction/TransactionManager.java b/src/main/java/com/avaje/ebeaninternal/server/transaction/TransactionManager.java index 58df88b19..d26c6c9cd 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/transaction/TransactionManager.java +++ b/src/main/java/com/avaje/ebeaninternal/server/transaction/TransactionManager.java @@ -28,8 +28,7 @@ import com.avaje.ebeaninternal.server.lib.sql.DataSourcePool; /** * Manages transactions. *

- * Keeps the Cache, Cluster and Lucene indexes in synch when transactions are - * committed. + * Keeps the Cache and Cluster in synch when transactions are committed. *

*/ public class TransactionManager { @@ -426,7 +425,7 @@ public class TransactionManager { } } catch (Exception ex) { - String m = "NotifyOfCommit failed. Cache/Lucene potentially not notified."; + String m = "NotifyOfCommit failed. L2 Cache potentially not notified."; logger.error(m, ex); } } diff --git a/src/main/java/com/avaje/ebeaninternal/server/type/ScalarTypeUtilDate.java b/src/main/java/com/avaje/ebeaninternal/server/type/ScalarTypeUtilDate.java index aaa4ad3b7..a8ddac7e9 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/type/ScalarTypeUtilDate.java +++ b/src/main/java/com/avaje/ebeaninternal/server/type/ScalarTypeUtilDate.java @@ -61,15 +61,6 @@ public class ScalarTypeUtilDate { public java.util.Date parseDateTime(long systemTimeMillis) { return new java.util.Date(systemTimeMillis); } - - public Object luceneFromIndexValue(Object value) { - Long l = (Long)value; - return new java.util.Date(l); - } - - public Object luceneToIndexValue(Object value) { - return ((java.util.Date)value).getTime(); - } } public static class DateType extends ScalarTypeBaseDate { diff --git a/src/main/java/com/avaje/ebeaninternal/util/DefaultExpressionRequest.java b/src/main/java/com/avaje/ebeaninternal/util/DefaultExpressionRequest.java index d9005129d..d9126cfaa 100644 --- a/src/main/java/com/avaje/ebeaninternal/util/DefaultExpressionRequest.java +++ b/src/main/java/com/avaje/ebeaninternal/util/DefaultExpressionRequest.java @@ -27,14 +27,6 @@ public class DefaultExpressionRequest implements SpiExpressionRequest { this.deployParser = deployParser; } - // public DefaultExpressionRequest(SpiOrmQueryRequest queryRequest, LIndex - // index) { - // this.queryRequest = queryRequest; - // this.beanDescriptor = queryRequest.getBeanDescriptor(); - // this.deployParser = null; - // this.luceneIndex = index; - // } - public DefaultExpressionRequest(BeanDescriptor beanDescriptor) { this.beanDescriptor = beanDescriptor; this.queryRequest = null; diff --git a/src/test/java/com/avaje/tests/query/TestExprNestedDisjunction.java b/src/test/java/com/avaje/tests/query/TestExprNestedDisjunction.java index f0b524995..2c6f0e764 100644 --- a/src/test/java/com/avaje/tests/query/TestExprNestedDisjunction.java +++ b/src/test/java/com/avaje/tests/query/TestExprNestedDisjunction.java @@ -6,7 +6,6 @@ import org.junit.Test; import com.avaje.ebean.BaseTestCase; import com.avaje.ebean.Ebean; import com.avaje.ebean.Query; -import com.avaje.ebean.Query.UseIndex; import com.avaje.tests.model.basic.Customer; import com.avaje.tests.model.basic.ResetBasicData; @@ -21,7 +20,7 @@ public class TestExprNestedDisjunction extends BaseTestCase { java.sql.Date onAfter = java.sql.Date.valueOf("2009-08-31"); - Query q = Ebean.find(Customer.class).setUseIndex(UseIndex.NO).where().disjunction() + Query q = Ebean.find(Customer.class).where().disjunction() .conjunction().startsWith("name", "r").eq("anniversary", onAfter).endJunction() .conjunction().eq("status", Customer.Status.ACTIVE).gt("id", 0).endJunction().orderBy() .asc("name");