mirror of https://github.com/apache/openjpa.git
OPENJPA-995: Refactor OpenJPA Criteria query implementation as 'dynamic query' extension.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@756730 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2d9f445cb8
commit
c3175eea3c
|
@ -21,16 +21,16 @@ package org.apache.openjpa.persistence.criteria;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.persistence.DomainObject;
|
|
||||||
import javax.persistence.EntityManager;
|
|
||||||
import javax.persistence.EntityManagerFactory;
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
import javax.persistence.Query;
|
import javax.persistence.Query;
|
||||||
import javax.persistence.QueryDefinition;
|
|
||||||
import javax.persistence.SelectItem;
|
|
||||||
|
|
||||||
|
import org.apache.openjpa.persistence.OpenJPAEntityManager;
|
||||||
|
import org.apache.openjpa.persistence.OpenJPAEntityManagerFactory;
|
||||||
|
import org.apache.openjpa.persistence.query.DomainObject;
|
||||||
|
import org.apache.openjpa.persistence.query.Expression;
|
||||||
import org.apache.openjpa.persistence.query.OpenJPAQueryBuilder;
|
import org.apache.openjpa.persistence.query.OpenJPAQueryBuilder;
|
||||||
import org.apache.openjpa.persistence.query.QueryBuilderImpl;
|
import org.apache.openjpa.persistence.query.QueryBuilderImpl;
|
||||||
|
import org.apache.openjpa.persistence.query.QueryDefinition;
|
||||||
|
import org.apache.openjpa.persistence.query.SelectItem;
|
||||||
import org.apache.openjpa.persistence.test.SingleEMFTestCase;
|
import org.apache.openjpa.persistence.test.SingleEMFTestCase;
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ import org.apache.openjpa.persistence.test.SingleEMFTestCase;
|
||||||
*/
|
*/
|
||||||
public class TestCriteria extends SingleEMFTestCase {
|
public class TestCriteria extends SingleEMFTestCase {
|
||||||
protected OpenJPAQueryBuilder qb;
|
protected OpenJPAQueryBuilder qb;
|
||||||
private static EntityManagerFactory emf = null;
|
private static OpenJPAEntityManagerFactory emf = null;
|
||||||
protected StringComparison comparator = new StringComparison();
|
protected StringComparison comparator = new StringComparison();
|
||||||
|
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
|
@ -82,7 +82,7 @@ public class TestCriteria extends SingleEMFTestCase {
|
||||||
VideoStore.class);
|
VideoStore.class);
|
||||||
emf = super.emf;
|
emf = super.emf;
|
||||||
}
|
}
|
||||||
qb = (QueryBuilderImpl)emf.getQueryBuilder();
|
qb = (QueryBuilderImpl)emf.getDynamicQueryBuilder();
|
||||||
emf.createEntityManager();
|
emf.createEntityManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -540,14 +540,14 @@ public class TestCriteria extends SingleEMFTestCase {
|
||||||
* their results.
|
* their results.
|
||||||
*/
|
*/
|
||||||
private void executeActually(String jpql, QueryDefinition q, Object...p) {
|
private void executeActually(String jpql, QueryDefinition q, Object...p) {
|
||||||
EntityManager em = emf.createEntityManager();
|
OpenJPAEntityManager em = emf.createEntityManager();
|
||||||
List<?> criteriaResult = null;
|
List<?> criteriaResult = null;
|
||||||
List<?> jpqlResult = null;
|
List<?> jpqlResult = null;
|
||||||
Throwable criteriaError = null;
|
Throwable criteriaError = null;
|
||||||
Throwable jpqlError = null;
|
Throwable jpqlError = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Query cq = em.createQuery(q);
|
Query cq = em.createDynamicQuery(q);
|
||||||
setParameters(cq, p);
|
setParameters(cq, p);
|
||||||
criteriaResult = cq.getResultList();
|
criteriaResult = cq.getResultList();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -30,6 +30,8 @@ import java.util.Set;
|
||||||
|
|
||||||
import javax.persistence.Cache;
|
import javax.persistence.Cache;
|
||||||
import javax.persistence.EntityManagerFactory;
|
import javax.persistence.EntityManagerFactory;
|
||||||
|
import javax.persistence.QueryBuilder;
|
||||||
|
|
||||||
import org.apache.openjpa.conf.OpenJPAConfiguration;
|
import org.apache.openjpa.conf.OpenJPAConfiguration;
|
||||||
import org.apache.openjpa.enhance.Reflection;
|
import org.apache.openjpa.enhance.Reflection;
|
||||||
import org.apache.openjpa.kernel.AutoDetach;
|
import org.apache.openjpa.kernel.AutoDetach;
|
||||||
|
@ -350,8 +352,12 @@ public class EntityManagerFactoryImpl
|
||||||
return getStoreCache();
|
return getStoreCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
public OpenJPAQueryBuilder getQueryBuilder() {
|
public QueryBuilder getQueryBuilder() {
|
||||||
return new QueryBuilderImpl(this);
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OpenJPAQueryBuilder getDynamicQueryBuilder() {
|
||||||
|
return new QueryBuilderImpl(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> getSupportedProperties() {
|
public Set<String> getSupportedProperties() {
|
||||||
|
|
|
@ -41,6 +41,7 @@ import javax.persistence.EntityManager;
|
||||||
import javax.persistence.FlushModeType;
|
import javax.persistence.FlushModeType;
|
||||||
import javax.persistence.LockModeType;
|
import javax.persistence.LockModeType;
|
||||||
import javax.persistence.Query;
|
import javax.persistence.Query;
|
||||||
|
import javax.persistence.QueryBuilder;
|
||||||
import javax.persistence.QueryDefinition;
|
import javax.persistence.QueryDefinition;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
@ -1482,7 +1483,12 @@ public class EntityManagerImpl
|
||||||
}
|
}
|
||||||
|
|
||||||
public Query createQuery(QueryDefinition qdef) {
|
public Query createQuery(QueryDefinition qdef) {
|
||||||
String jpql = getQueryBuilder().toJPQL(qdef);
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OpenJPAQuery createDynamicQuery(
|
||||||
|
org.apache.openjpa.persistence.query.QueryDefinition qdef) {
|
||||||
|
String jpql = _emf.getDynamicQueryBuilder().toJPQL(qdef);
|
||||||
return createQuery(jpql);
|
return createQuery(jpql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1501,8 +1507,8 @@ public class EntityManagerImpl
|
||||||
return finalMap;
|
return finalMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OpenJPAQueryBuilder getQueryBuilder() {
|
public QueryBuilder getQueryBuilder() {
|
||||||
return new QueryBuilderImpl(_emf);
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> getSupportedProperties() {
|
public Set<String> getSupportedProperties() {
|
||||||
|
|
|
@ -31,6 +31,7 @@ import org.apache.openjpa.kernel.AutoDetach;
|
||||||
import org.apache.openjpa.kernel.ConnectionRetainModes;
|
import org.apache.openjpa.kernel.ConnectionRetainModes;
|
||||||
import org.apache.openjpa.kernel.DetachState;
|
import org.apache.openjpa.kernel.DetachState;
|
||||||
import org.apache.openjpa.kernel.RestoreState;
|
import org.apache.openjpa.kernel.RestoreState;
|
||||||
|
import org.apache.openjpa.persistence.query.QueryDefinition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface implemented by OpenJPA entity managers.
|
* Interface implemented by OpenJPA entity managers.
|
||||||
|
@ -660,6 +661,13 @@ public interface OpenJPAEntityManager
|
||||||
* Create a new query in the given language.
|
* Create a new query in the given language.
|
||||||
*/
|
*/
|
||||||
public OpenJPAQuery createQuery(String language, String query);
|
public OpenJPAQuery createQuery(String language, String query);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an executable query from a dynamically defined query.
|
||||||
|
*
|
||||||
|
* @since 2.0.0
|
||||||
|
*/
|
||||||
|
public OpenJPAQuery createDynamicQuery(QueryDefinition dynamic);
|
||||||
|
|
||||||
///////////
|
///////////
|
||||||
// Locking
|
// Locking
|
||||||
|
|
|
@ -20,9 +20,11 @@ package org.apache.openjpa.persistence;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
|
||||||
import javax.persistence.EntityManagerFactory;
|
import javax.persistence.EntityManagerFactory;
|
||||||
|
|
||||||
|
import org.apache.openjpa.persistence.query.QueryBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface implemented by OpenJPA entity manager factories.
|
* Interface implemented by OpenJPA entity manager factories.
|
||||||
*
|
*
|
||||||
|
@ -123,4 +125,9 @@ public interface OpenJPAEntityManagerFactory
|
||||||
* method pierces the published-API boundary, as does the SPI cast.
|
* method pierces the published-API boundary, as does the SPI cast.
|
||||||
*/
|
*/
|
||||||
public void removeTransactionListener(Object listener);
|
public void removeTransactionListener(Object listener);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a builder for dynamic queries.
|
||||||
|
*/
|
||||||
|
public QueryBuilder getDynamicQueryBuilder();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,17 +22,6 @@ import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.persistence.CaseExpression;
|
|
||||||
import javax.persistence.DomainObject;
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
import javax.persistence.FetchJoinObject;
|
|
||||||
import javax.persistence.OrderByItem;
|
|
||||||
import javax.persistence.PathExpression;
|
|
||||||
import javax.persistence.Predicate;
|
|
||||||
import javax.persistence.QueryDefinition;
|
|
||||||
import javax.persistence.SelectItem;
|
|
||||||
import javax.persistence.Subquery;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Domain Object is a path expression over which query is evaluated.
|
* Domain Object is a path expression over which query is evaluated.
|
||||||
* Domain object acts as a proxy for a QueryDefinition via delegation.
|
* Domain object acts as a proxy for a QueryDefinition via delegation.
|
||||||
|
|
|
@ -20,11 +20,6 @@ package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
import javax.persistence.Aggregate;
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
import javax.persistence.PathExpression;
|
|
||||||
import javax.persistence.Predicate;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An abstract path is formed by two parts : the first part is a parent path.
|
* An abstract path is formed by two parts : the first part is a parent path.
|
||||||
* The second part can be an attribute or an operation (e.g. KEY() or VALUE())
|
* The second part can be an attribute or an operation (e.g. KEY() or VALUE())
|
||||||
|
@ -49,7 +44,8 @@ abstract class AbstractPath extends ExpressionImpl implements
|
||||||
protected final PathOperator _operator;
|
protected final PathOperator _operator;
|
||||||
protected final QueryDefinitionImpl _owner;
|
protected final QueryDefinitionImpl _owner;
|
||||||
|
|
||||||
protected AbstractPath(QueryDefinitionImpl owner, AbstractPath parent, PathOperator op, Object part2) {
|
protected AbstractPath(QueryDefinitionImpl owner, AbstractPath parent,
|
||||||
|
PathOperator op, Object part2) {
|
||||||
_owner = owner;
|
_owner = owner;
|
||||||
_parent = parent;
|
_parent = parent;
|
||||||
_part2 = part2;
|
_part2 = part2;
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type of the result of an aggregate operation
|
||||||
|
*/
|
||||||
|
public interface Aggregate extends Expression {
|
||||||
|
/**
|
||||||
|
* Specify that duplicates are to be removed before the aggregate operation
|
||||||
|
* is invoked.
|
||||||
|
*/
|
||||||
|
Expression distinct();
|
||||||
|
}
|
|
@ -22,8 +22,6 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Stack;
|
import java.util.Stack;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
import org.apache.openjpa.meta.MetaDataRepository;
|
import org.apache.openjpa.meta.MetaDataRepository;
|
||||||
|
|
||||||
class AliasContext {
|
class AliasContext {
|
||||||
|
|
|
@ -18,10 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.DomainObject;
|
|
||||||
import javax.persistence.QueryDefinition;
|
|
||||||
import javax.persistence.Subquery;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes All(SubQuery) Expression.
|
* Denotes All(SubQuery) Expression.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Predicate;
|
|
||||||
import static org.apache.openjpa.persistence.query.ConditionalOperator.*;
|
import static org.apache.openjpa.persistence.query.ConditionalOperator.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -18,9 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.QueryDefinition;
|
|
||||||
import javax.persistence.Subquery;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes ANY(SUbquery) Expression.
|
* Denotes ANY(SUbquery) Expression.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,9 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes e1 BETWEEN(e2 AND e3) Expression.
|
* Denotes e1 BETWEEN(e2 AND e3) Expression.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,9 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
import javax.persistence.Predicate;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Binary predicate combines two expressions with an operator.
|
* Binary predicate combines two expressions with an operator.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An expression resulting from a binary operation on two expressions.
|
* An expression resulting from a binary operation on two expressions.
|
||||||
*
|
*
|
||||||
|
|
|
@ -0,0 +1,299 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for the construction of case expressions
|
||||||
|
*/
|
||||||
|
public interface CaseExpression {
|
||||||
|
/**
|
||||||
|
* Add a when predicate clause to a general case expression. The when
|
||||||
|
* predicate must be followed by the corresponding then case expression that
|
||||||
|
* specifies the result of the specific case. Clauses are evaluated in the
|
||||||
|
* order added.
|
||||||
|
*
|
||||||
|
* @param pred -
|
||||||
|
* corresponds to the evaluation condition for the specific case
|
||||||
|
* @return CaseExpression corresponding to the case with the added when
|
||||||
|
* clause
|
||||||
|
*/
|
||||||
|
CaseExpression when(Predicate pred);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a when clause to a simple case expression. The when case expression
|
||||||
|
* must be followed by the corresponding then case expression that specifies
|
||||||
|
* the result of the specific case. Clauses are evaluated in the order added
|
||||||
|
*
|
||||||
|
* @param when -
|
||||||
|
* corresponds to the value against which the case operand of the
|
||||||
|
* simple case is tested
|
||||||
|
* @return CaseExpression corresponding to the case with the added clause
|
||||||
|
*/
|
||||||
|
CaseExpression when(Expression when);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a when clause to a simple case expression. The when case expression
|
||||||
|
* must be followed by the corresponding then case expression that specifies
|
||||||
|
* the result of the specific case. Clauses are evaluated in the order added
|
||||||
|
*
|
||||||
|
* @param when -
|
||||||
|
* corresponds to the value against which the case operand of the
|
||||||
|
* simple case is tested
|
||||||
|
* @return CaseExpression corresponding to the case with the added clause
|
||||||
|
*/
|
||||||
|
CaseExpression when(Number when);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a when clause to a simple case expression. The when case expression
|
||||||
|
* must be followed by the corresponding then case expression that specifies
|
||||||
|
* the result of the specific case. Clauses are evaluated in the order added
|
||||||
|
*
|
||||||
|
* @param when -
|
||||||
|
* corresponds to the value against which the
|
||||||
|
* case operand of the simple case is tested
|
||||||
|
* @return CaseExpression corresponding to the case with the added clause
|
||||||
|
*/
|
||||||
|
CaseExpression when(String when);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a when clause to a simple case expression. The when case expression
|
||||||
|
* must be followed by the corresponding then case expression that specifies
|
||||||
|
* the result of the specific case. Clauses are evaluated in the order added
|
||||||
|
*
|
||||||
|
* @param when -
|
||||||
|
* corresponds to the value against which the case operand of the
|
||||||
|
* simple case is tested
|
||||||
|
* @return CaseExpression corresponding to the case with the added clause
|
||||||
|
*/
|
||||||
|
CaseExpression when(Date when);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a when clause to a simple case expression. The when case expression
|
||||||
|
* must be followed by the corresponding then case expression that specifies
|
||||||
|
* the result of the specific case. Clauses are evaluated in the order added
|
||||||
|
*
|
||||||
|
* @param when -
|
||||||
|
* corresponds to the value against which the case operand of the
|
||||||
|
* simple case is tested
|
||||||
|
* @return CaseExpression corresponding to the case with the added clause
|
||||||
|
*/
|
||||||
|
CaseExpression when(Calendar when);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a when clause to a simple case expression. The when case expression
|
||||||
|
* must be followed by the corresponding then case expression that specifies
|
||||||
|
* the result of the specific case. Clauses are evaluated in the order added
|
||||||
|
*
|
||||||
|
* @param when -
|
||||||
|
* corresponds to the value against which the case operand of the
|
||||||
|
* simple case is tested
|
||||||
|
* @return CaseExpression corresponding to the case with the added clause
|
||||||
|
*/
|
||||||
|
CaseExpression when(Class when);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a when clause to a simple case expression. The when case expression
|
||||||
|
* must be followed by the corresponding then case expression that specifies
|
||||||
|
* the result of the specific case. Clauses are evaluated in the order added
|
||||||
|
*
|
||||||
|
* @param when -
|
||||||
|
* corresponds to the value against which the case operand of the
|
||||||
|
* simple case is tested
|
||||||
|
* @return CaseExpression corresponding to the case with the added clause
|
||||||
|
*/
|
||||||
|
CaseExpression when(Enum<?> when);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a then clause to a general or simple case expression. The then clause
|
||||||
|
* specifies the result corresponding to the immediately preceding when.
|
||||||
|
* Clauses are evaluated in the order added.
|
||||||
|
*
|
||||||
|
* @param then -
|
||||||
|
* corresponds to the result of the case expression if the when
|
||||||
|
* is satisfied
|
||||||
|
* @return CaseExpression corresponding to the case with the added then
|
||||||
|
* clause
|
||||||
|
*/
|
||||||
|
CaseExpression then(Expression then);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a then clause to a general or simple case expression. The then clause
|
||||||
|
* specifies the result corresponding to the immediately preceding when.
|
||||||
|
* Clauses are evaluated in the order added.
|
||||||
|
*
|
||||||
|
* @param then -
|
||||||
|
* corresponds to the result of the case expression if the when
|
||||||
|
* is satisfied
|
||||||
|
* @return CaseExpression corresponding to the case with the added then
|
||||||
|
* clause
|
||||||
|
*/
|
||||||
|
CaseExpression then(Number then);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a then clause to a general or simple case expression. The then clause
|
||||||
|
* specifies the result corresponding to the immediately preceding when.
|
||||||
|
* Clauses are evaluated in the order added.
|
||||||
|
*
|
||||||
|
* @param then -
|
||||||
|
* corresponds to the result of the case expression if the when
|
||||||
|
* is satisfied
|
||||||
|
* @return CaseExpression corresponding to the case with the added then
|
||||||
|
* clause
|
||||||
|
*/
|
||||||
|
CaseExpression then(String then);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a then clause to a general or simple case expression. The then clause
|
||||||
|
* specifies the result corresponding to the immediately preceding when.
|
||||||
|
* Clauses are evaluated in the order added.
|
||||||
|
*
|
||||||
|
* @param then -
|
||||||
|
* corresponds to the result of the case expression if the when
|
||||||
|
* is satisfied
|
||||||
|
* @return CaseExpression corresponding to the case with the added then
|
||||||
|
* clause
|
||||||
|
*/
|
||||||
|
CaseExpression then(Date then);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a then clause to a general or simple case expression. The then clause
|
||||||
|
* specifies the result corresponding to the immediately preceding when.
|
||||||
|
* Clauses are evaluated in the order added.
|
||||||
|
*
|
||||||
|
* @param then -
|
||||||
|
* corresponds to the result of the case expression if the when
|
||||||
|
* is satisfied
|
||||||
|
* @return CaseExpression corresponding to the case with the added then
|
||||||
|
* clause
|
||||||
|
*/
|
||||||
|
CaseExpression then(Calendar then);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a then clause to a general or simple case expression. The then clause
|
||||||
|
* specifies the result corresponding to the immediately preceding when.
|
||||||
|
* Clauses are evaluated in the order added.
|
||||||
|
*
|
||||||
|
* @param then -
|
||||||
|
* corresponds to the result of the case expression if the when
|
||||||
|
* is satisfied
|
||||||
|
* @return CaseExpression corresponding to the case with the added then
|
||||||
|
* clause
|
||||||
|
*/
|
||||||
|
CaseExpression then(Class then);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a then clause to a general or simple case expression. The then clause
|
||||||
|
* specifies the result corresponding to the immediately preceding when.
|
||||||
|
* Clauses are evaluated in the order added.
|
||||||
|
*
|
||||||
|
* @param then -
|
||||||
|
* corresponds to the result of the case expression if the when
|
||||||
|
* is satisfied
|
||||||
|
* @return CaseExpression corresponding to the case with the added then
|
||||||
|
* clause
|
||||||
|
*/
|
||||||
|
CaseExpression then(Enum<?> then);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add else to a case expression. A case expression must have an else
|
||||||
|
* clause.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* corresponds to the result of the case expression if the when
|
||||||
|
* condition is not satisfied
|
||||||
|
* @return Expression corresponding to the case expression with the added
|
||||||
|
* clause
|
||||||
|
*/
|
||||||
|
Expression elseCase(Expression arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add else to a case expression. A case expression must have an else
|
||||||
|
* clause.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* corresponds to the result of the case expression if the when
|
||||||
|
* condition is not satisfied
|
||||||
|
* @return Expression corresponding to the case expression with the added
|
||||||
|
* clause
|
||||||
|
*/
|
||||||
|
Expression elseCase(String arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add else to a case expression. A case expression must have an else
|
||||||
|
* clause.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* corresponds to the result of the case expression if the when
|
||||||
|
* condition is not satisfied
|
||||||
|
* @return Expression corresponding to the case expression with the added
|
||||||
|
* clause
|
||||||
|
*/
|
||||||
|
Expression elseCase(Number arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add else to a case expression. A case expression must have an else
|
||||||
|
* clause.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* corresponds to the result of the case expression if the when
|
||||||
|
* condition is not satisfied
|
||||||
|
* @return Expression corresponding to the case expression with the added
|
||||||
|
* clause
|
||||||
|
*/
|
||||||
|
Expression elseCase(Date arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add else to a case expression. A case expression must have an else
|
||||||
|
* clause.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* corresponds to the result of the case expression if the when
|
||||||
|
* condition is not satisfied
|
||||||
|
* @return Expression corresponding to the case expression with the added
|
||||||
|
* clause
|
||||||
|
*/
|
||||||
|
Expression elseCase(Calendar arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add else to a case expression. A case expression must have an else
|
||||||
|
* clause.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* corresponds to the result of the case expression if the when
|
||||||
|
* condition is not satisfied
|
||||||
|
* @return Expression corresponding to the case expression with the added
|
||||||
|
* clause
|
||||||
|
*/
|
||||||
|
Expression elseCase(Class arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add else to a case expression. A case expression must have an else
|
||||||
|
* clause.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* corresponds to the result of the case expression if the when
|
||||||
|
* condition is not satisfied
|
||||||
|
* @return Expression corresponding to the case expression with the added
|
||||||
|
* clause
|
||||||
|
*/
|
||||||
|
Expression elseCase(Enum<?> arg);
|
||||||
|
}
|
|
@ -22,10 +22,6 @@ import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
import javax.persistence.CaseExpression;
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
import javax.persistence.Predicate;
|
|
||||||
|
|
||||||
public class CaseExpressionImpl implements CaseExpression, Visitable {
|
public class CaseExpressionImpl implements CaseExpression, Visitable {
|
||||||
private LinkedList<WhenClause> _whens = new LinkedList<WhenClause>();
|
private LinkedList<WhenClause> _whens = new LinkedList<WhenClause>();
|
||||||
private final Object _caseOperand;
|
private final Object _caseOperand;
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes COUNT(e) Expression.
|
* Denotes COUNT(e) Expression.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes DISTINCT(e) Expression.
|
* Denotes DISTINCT(e) Expression.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes e1/e2 Expression.
|
* Denotes e1/e2 Expression.
|
||||||
*
|
*
|
||||||
|
|
|
@ -0,0 +1,123 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Domain objects define the domain over which a query operates. A domain object
|
||||||
|
* plays a role analogous to that of a Java Persistence query language
|
||||||
|
* identification variable.
|
||||||
|
*/
|
||||||
|
public interface DomainObject extends PathExpression, QueryDefinition {
|
||||||
|
/**
|
||||||
|
* Extend the query domain by joining with a class that can be navigated to
|
||||||
|
* or that is embedded in the class corresponding to the domain object on
|
||||||
|
* which the method is invoked. This method is permitted to be invoked only
|
||||||
|
* when defining the domain of the query. It must not be invoked within the
|
||||||
|
* context of the select, where, groupBy, or having operations. The domain
|
||||||
|
* object must correspond to a class that contains the referenced attribute.
|
||||||
|
* The query definition is modified to include the newly joined domain
|
||||||
|
* object.
|
||||||
|
*
|
||||||
|
* @param attribute -
|
||||||
|
* name of the attribute that references the target of the join
|
||||||
|
* @return the new DomainObject that is added for the target of the join
|
||||||
|
*/
|
||||||
|
DomainObject join(String attribute);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extend the query domain by left outer joining with a class that can be
|
||||||
|
* navigated to or that is embedded in the class corresponding to the domain
|
||||||
|
* object on which the method is invoked. This method is permitted to be
|
||||||
|
* invoked only when defining the domain of the query. It must not be
|
||||||
|
* invoked within the context of the select, where, groupBy, or having
|
||||||
|
* operations. The domain object must correspond to a class that contains
|
||||||
|
* the referenced attribute. The query definition is modified to include the
|
||||||
|
* newly joined domain object.
|
||||||
|
*
|
||||||
|
* @param attribute -
|
||||||
|
* name of the attribute that references the target of the join
|
||||||
|
* @return the new DomainObject that is added for the target of the join
|
||||||
|
*/
|
||||||
|
DomainObject leftJoin(String attribute);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify that the association or element collection that is referenced by
|
||||||
|
* the attribute be eagerly fetched through use of an inner join. The domain
|
||||||
|
* object must correspond to a class that contains the referenced attribute.
|
||||||
|
* The query is modified to include the joined domain object.
|
||||||
|
*
|
||||||
|
* @param attribute -
|
||||||
|
* name of the attribute that references the target of the join
|
||||||
|
* @return the FetchJoinObject that is added for the target of the join
|
||||||
|
*/
|
||||||
|
FetchJoinObject joinFetch(String attribute);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify that the association or element collection that is referenced by
|
||||||
|
* the attribute be eagerly fetched through use of a left outer join. The
|
||||||
|
* domain object must correspond to a class that contains the referenced
|
||||||
|
* attribute. The query is modified to include the joined domain object.
|
||||||
|
*
|
||||||
|
* @param attribute -
|
||||||
|
* name of the attribute that references the target of the join
|
||||||
|
* @return the FetchJoinObject that is added for the target of the join
|
||||||
|
*/
|
||||||
|
FetchJoinObject leftJoinFetch(String attribute);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a path expression corresponding to the value of a map-valued
|
||||||
|
* association or element collection. This method is only permitted to be
|
||||||
|
* invoked upon a domain object that corresponds to a map-valued association
|
||||||
|
* or element collection.
|
||||||
|
*
|
||||||
|
* @return PathExpression corresponding to the map value
|
||||||
|
*/
|
||||||
|
PathExpression value();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a path expression corresponding to the key of a map-valued
|
||||||
|
* association or element collection. This method is only permitted to be
|
||||||
|
* invoked upon a domain object that corresponds to a map-valued association
|
||||||
|
* or element collection.
|
||||||
|
*
|
||||||
|
* @return PathExpression corresponding to the map key
|
||||||
|
*/
|
||||||
|
PathExpression key();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a select item corresponding to the map entry of a map-valued
|
||||||
|
* association or element collection. This method is only permitted to be
|
||||||
|
* invoked upon a domain object that corresponds to a map-valued association
|
||||||
|
* or element collection.
|
||||||
|
*
|
||||||
|
* @return SelectItem corresponding to the map entry
|
||||||
|
*/
|
||||||
|
SelectItem entry();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return an expression that corresponds to the index. of the domain object
|
||||||
|
* in the referenced association or element collection. This method is only
|
||||||
|
* permitted to be invoked upon a domain object that corresponds to a
|
||||||
|
* multi-valued association or element collection for which an order column
|
||||||
|
* has been defined.
|
||||||
|
*
|
||||||
|
* @return Expression denoting the index
|
||||||
|
*/
|
||||||
|
Expression index();
|
||||||
|
}
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Else clause in a Case Statement.
|
* Else clause in a Case Statement.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes e1 = e2 Expression.
|
* Denotes e1 = e2 Expression.
|
||||||
*
|
*
|
||||||
|
@ -28,7 +26,10 @@ import javax.persistence.Expression;
|
||||||
*/
|
*/
|
||||||
public class EqualExpression extends BinaryExpressionPredicate {
|
public class EqualExpression extends BinaryExpressionPredicate {
|
||||||
public EqualExpression(Expression op1, Expression op2) {
|
public EqualExpression(Expression op1, Expression op2) {
|
||||||
super(op1, BinaryConditionalOperator.EQUAL, BinaryConditionalOperator.EQUAL_NOT, op2);
|
super(op1,
|
||||||
|
BinaryConditionalOperator.EQUAL,
|
||||||
|
BinaryConditionalOperator.EQUAL_NOT,
|
||||||
|
op2);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,524 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instances of this interface can be used either as select list items or as
|
||||||
|
* predicate operands.
|
||||||
|
*/
|
||||||
|
public interface Expression extends SelectItem, PredicateOperand {
|
||||||
|
/*
|
||||||
|
* Conditional predicates over expression items
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the expression is a member of the
|
||||||
|
* association or element collection denoted by the path expression. The
|
||||||
|
* argument must correspond to a collection-valued association or element
|
||||||
|
* collection of like type.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* a path expression that specifies a collection-valued
|
||||||
|
* association or an element collection
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate member(PathExpression arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the value of the expression is
|
||||||
|
* null.
|
||||||
|
*
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate isNull();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the expression value is a member
|
||||||
|
* of the argument list.
|
||||||
|
*
|
||||||
|
* @param strings
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate in(String... strings);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the expression value is a member
|
||||||
|
* of the argument list.
|
||||||
|
*
|
||||||
|
* @param nums
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate in(Number... nums);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the expression value is a member
|
||||||
|
* of the argument list.
|
||||||
|
*
|
||||||
|
* @param enums
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate in(Enum<?>... enums);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the expression value is a member
|
||||||
|
* of the argument list.
|
||||||
|
*
|
||||||
|
* @param classes
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate in(Class... classes);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the expression value is a member
|
||||||
|
* of the argument list.
|
||||||
|
*
|
||||||
|
* @param params
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate in(Expression... params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the expression value is a member
|
||||||
|
* of a subquery result.
|
||||||
|
*
|
||||||
|
* @param subquery
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate in(Subquery subquery);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Operations on strings
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* String length This method must be invoked on an expression corresponding
|
||||||
|
* to a string.
|
||||||
|
*
|
||||||
|
* @return expression denoting the length of the string.
|
||||||
|
*/
|
||||||
|
Expression length();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Concatenate a string with other string(s). This method must be invoked on
|
||||||
|
* an expression corresponding to a string.
|
||||||
|
*
|
||||||
|
* @param str -
|
||||||
|
* string(s)
|
||||||
|
* @return expression denoting the concatenation of the strings, starting
|
||||||
|
* with the string corresponding to the expression on which the
|
||||||
|
* method was invoked.
|
||||||
|
*/
|
||||||
|
Expression concat(String... str);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Concatenate a string with other string(s). This method must be invoked on
|
||||||
|
* an expression corresponding to a string.
|
||||||
|
*
|
||||||
|
* @param str -
|
||||||
|
* expression(s) corresponding to string(s)
|
||||||
|
* @return expression denoting the concatenation of the strings, starting
|
||||||
|
* with the string corresponding to the expression on which the
|
||||||
|
* method was invoked.
|
||||||
|
*/
|
||||||
|
Expression concat(Expression... str);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract a substring starting at specified position through to the end of
|
||||||
|
* the string. This method must be invoked on an expression corresponding to
|
||||||
|
* a string.
|
||||||
|
*
|
||||||
|
* @param start -
|
||||||
|
* start position (1 indicates first position)
|
||||||
|
* @return expression denoting the extracted substring
|
||||||
|
*/
|
||||||
|
Expression substring(int start);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract a substring starting at specified position through to the end of
|
||||||
|
* the string. This method must be invoked on an expression corresponding to
|
||||||
|
* a string.
|
||||||
|
*
|
||||||
|
* @param start -
|
||||||
|
* expression denoting start position (1 indicates first
|
||||||
|
* position)
|
||||||
|
* @return expression denoting the extracted substring
|
||||||
|
*/
|
||||||
|
Expression substring(Expression start);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract a substring. This method must be invoked on an expression
|
||||||
|
* corresponding to a string.
|
||||||
|
*
|
||||||
|
* @param start -
|
||||||
|
* start position (1 indicates first position)
|
||||||
|
* @param len -
|
||||||
|
* length of the substring to be returned
|
||||||
|
* @return expression denoting the extracted substring
|
||||||
|
*/
|
||||||
|
Expression substring(int start, int len);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract a substring. This method must be invoked on an expression
|
||||||
|
* corresponding to a string.
|
||||||
|
*
|
||||||
|
* @param start -
|
||||||
|
* start position (1 indicates first position)
|
||||||
|
* @param len -
|
||||||
|
* expression denoting length of the substring to return
|
||||||
|
* @return expression denoting the extracted substring
|
||||||
|
*/
|
||||||
|
Expression substring(int start, Expression len);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract a substring. This method must be invoked on an expression
|
||||||
|
* corresponding to a string.
|
||||||
|
*
|
||||||
|
* @param start -
|
||||||
|
* expression denoting start position (1 indicates first
|
||||||
|
* position)
|
||||||
|
* @param len -
|
||||||
|
* length of the substring to return
|
||||||
|
* @return expression denoting the extracted substring
|
||||||
|
*/
|
||||||
|
Expression substring(Expression start, int len);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract a substring. This method must be invoked on an expression
|
||||||
|
* corresponding to a string.
|
||||||
|
*
|
||||||
|
* @param start -
|
||||||
|
* expression denoting start position (1 indicates first
|
||||||
|
* position)
|
||||||
|
* @param len -
|
||||||
|
* expression denoting length of the substring to return
|
||||||
|
* @return expression denoting the extracted substring
|
||||||
|
*/
|
||||||
|
Expression substring(Expression start, Expression len);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert string to lowercase. This method must be invoked on an expression
|
||||||
|
* corresponding to a string.
|
||||||
|
*
|
||||||
|
* @return expression denoting the string in lowercase
|
||||||
|
*/
|
||||||
|
Expression lower();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert string to uppercase. This method must be invoked on an expression
|
||||||
|
* corresponding to a string.
|
||||||
|
*
|
||||||
|
* @return expression denoting the string in uppercase
|
||||||
|
*/
|
||||||
|
Expression upper();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trim leading and trailing blanks. This method must be invoked on an
|
||||||
|
* expression corresponding to a string.
|
||||||
|
*
|
||||||
|
* @return expression denoting trimmed string
|
||||||
|
*/
|
||||||
|
Expression trim();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trim leading, trailing blanks (or both) as specified by trim spec. This
|
||||||
|
* method must be invoked on an expression corresponding to a string.
|
||||||
|
*
|
||||||
|
* @param spec -
|
||||||
|
* trim specification
|
||||||
|
* @return expression denoting trimmed string
|
||||||
|
*/
|
||||||
|
Expression trim(TrimSpec spec);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trim leading and trailing occurrences of character from the string. This
|
||||||
|
* method must be invoked on an expression corresponding to a string.
|
||||||
|
*
|
||||||
|
* @param c -
|
||||||
|
* character to be trimmed
|
||||||
|
* @return expression denoting trimmed string
|
||||||
|
*/
|
||||||
|
Expression trim(char c);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trim occurrences of the character from leading or trailing (or both)
|
||||||
|
* positions of the string, as specified by trim spec. This method must be
|
||||||
|
* invoked on an expression corresponding to a string.
|
||||||
|
*
|
||||||
|
* @param c -
|
||||||
|
* character to be trimmed
|
||||||
|
* @param spec -
|
||||||
|
* trim specification
|
||||||
|
* @return expression denoting trimmed string
|
||||||
|
*/
|
||||||
|
Expression trim(char c, TrimSpec spec);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trim leading and trailing occurrences of character specified by the
|
||||||
|
* expression argument from the string. This method must be invoked on an
|
||||||
|
* expression corresponding to a string.
|
||||||
|
*
|
||||||
|
* @param expr -
|
||||||
|
* expression corresponding to the character to be trimmed
|
||||||
|
* @return expression denoting trimmed string
|
||||||
|
*/
|
||||||
|
Expression trim(Expression expr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trim occurrences of the character specified by the expression argument
|
||||||
|
* from leading or trailing (or both) positions of the string, as specified
|
||||||
|
* by trim spec. This method must be invoked on an expression corresponding
|
||||||
|
* to a string.
|
||||||
|
*
|
||||||
|
* @param expr -
|
||||||
|
* expression corresponding to the character to be trimmed
|
||||||
|
* @param spec -
|
||||||
|
* trim specification
|
||||||
|
* @return expression denoting trimmed string
|
||||||
|
*/
|
||||||
|
Expression trim(Expression expr, TrimSpec spec);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Locate a string contained within the string corresponding to the
|
||||||
|
* expression on which the method was invoked. The search is started at
|
||||||
|
* position 1 (first string position). This method must be invoked on an
|
||||||
|
* expression corresponding to a string.
|
||||||
|
*
|
||||||
|
* @param str -
|
||||||
|
* string to be located
|
||||||
|
* @return expression denoting the first position at which the string was
|
||||||
|
* found or expression denoting 0 if the string was not found
|
||||||
|
*/
|
||||||
|
Expression locate(String str);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Locate a string contained within the string corresponding to the
|
||||||
|
* expression on which the method was invoked. The search is started at
|
||||||
|
* position 1 (first string position). This method must be invoked on an
|
||||||
|
* expression corresponding to a string.
|
||||||
|
*
|
||||||
|
* @param str -
|
||||||
|
* expression corresponding to the string to be located
|
||||||
|
* @return expression denoting the first position at which the string was
|
||||||
|
* found or expression denoting 0 if the string was not found
|
||||||
|
*/
|
||||||
|
Expression locate(Expression str);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Locate a string contained within the string corresponding to the
|
||||||
|
* expression on which the method was invoked, starting at a specified
|
||||||
|
* search position. This method must be invoked on an expression
|
||||||
|
* corresponding to a string.
|
||||||
|
*
|
||||||
|
* @param str -
|
||||||
|
* string to be located
|
||||||
|
* @param position -
|
||||||
|
* position at which to start the search
|
||||||
|
* @return expression denoting the first position at which the string was
|
||||||
|
* found or expression denoting 0 if the string was not found
|
||||||
|
*/
|
||||||
|
Expression locate(String str, int position);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Locate a string contained within the string corresponding to the
|
||||||
|
* expression on which the method was invoked, starting at a specified
|
||||||
|
* search position. This method must be invoked on an expression
|
||||||
|
* corresponding to a string.
|
||||||
|
*
|
||||||
|
* @param str -
|
||||||
|
* string to be located
|
||||||
|
* @param position -
|
||||||
|
* expression corresponding to position at which to start the
|
||||||
|
* search
|
||||||
|
* @return expression denoting the first position at which the string was
|
||||||
|
* found or expression denoting 0 if the string was not found
|
||||||
|
*/
|
||||||
|
Expression locate(String str, Expression position);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Locate a string contained within the string corresponding to the
|
||||||
|
* expression on which the method was invoked, starting at a specified
|
||||||
|
* search position. This method must be invoked on an expression
|
||||||
|
* corresponding to a string.
|
||||||
|
*
|
||||||
|
* @param str -
|
||||||
|
* expression corresponding to the string to be located
|
||||||
|
* @param position -
|
||||||
|
* position at which to start the search
|
||||||
|
* @return expression denoting the first position at which the string was
|
||||||
|
* found or expression denoting 0 if the string was not found
|
||||||
|
*/
|
||||||
|
Expression locate(Expression str, int position);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Locate a string contained within the string corresponding to the
|
||||||
|
* expression on which the method was invoked, starting at a specified
|
||||||
|
* search position. This method must be invoked on an expression
|
||||||
|
* corresponding to a string.
|
||||||
|
*
|
||||||
|
* @param str -
|
||||||
|
* expression corresponding to the string to be located
|
||||||
|
* @param position -
|
||||||
|
* expression corresponding to position at which to start the
|
||||||
|
* search
|
||||||
|
* @return expression denoting the first position at which the string was
|
||||||
|
* found or expression denoting 0 if the string was not found
|
||||||
|
*/
|
||||||
|
Expression locate(Expression str, Expression position);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Arithmetic operations
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* Addition. This method must be invoked on an expression corresponding to a
|
||||||
|
* number.
|
||||||
|
*
|
||||||
|
* @param num -
|
||||||
|
* number to be added
|
||||||
|
* @return expression denoting the sum
|
||||||
|
*/
|
||||||
|
Expression plus(Number num);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Addition. This method must be invoked on an expression corresponding to a
|
||||||
|
* number.
|
||||||
|
*
|
||||||
|
* @param expr -
|
||||||
|
* expression corresponding to number to be added
|
||||||
|
* @return expression denoting the sum
|
||||||
|
*/
|
||||||
|
Expression plus(Expression expr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unary minus. This method must be invoked on an expression corresponding
|
||||||
|
* to a number.
|
||||||
|
*
|
||||||
|
* @return expression denoting the unary minus of the expression
|
||||||
|
*/
|
||||||
|
Expression minus();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subtraction. This method must be invoked on an expression corresponding
|
||||||
|
* to a number.
|
||||||
|
*
|
||||||
|
* @param num -
|
||||||
|
* subtrahend
|
||||||
|
* @return expression denoting the result of subtracting the argument from
|
||||||
|
* the number corresponding to the expression on which the method
|
||||||
|
* was invoked.
|
||||||
|
*/
|
||||||
|
Expression minus(Number num);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subtraction. This method must be invoked on an expression corresponding
|
||||||
|
* to a number.
|
||||||
|
*
|
||||||
|
* @param expr -
|
||||||
|
* expression corresponding to subtrahend
|
||||||
|
* @return expression denoting the result of subtracting the number denoted
|
||||||
|
* by the argument from the number corresponding to the expression
|
||||||
|
* on which the method was invoked.
|
||||||
|
*/
|
||||||
|
Expression minus(Expression expr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Division. This method must be invoked on an expression corresponding to a
|
||||||
|
* number.
|
||||||
|
*
|
||||||
|
* @param num -
|
||||||
|
* divisor
|
||||||
|
* @return expression denoting the result of dividing the number
|
||||||
|
* corresponding to the expression on which the method was invoked
|
||||||
|
* by the argument
|
||||||
|
*/
|
||||||
|
Expression dividedBy(Number num);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Division. This method must be invoked on an expression corresponding to a
|
||||||
|
* number.
|
||||||
|
*
|
||||||
|
* @param expr -
|
||||||
|
* expression corresponding to the divisor
|
||||||
|
* @return expression denoting the result of dividing the number
|
||||||
|
* corresponding to the expression on which the method was invoked
|
||||||
|
* by the number denoted by the argument
|
||||||
|
*/
|
||||||
|
Expression dividedBy(Expression expr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Multiplication. This method must be invoked on an expression
|
||||||
|
* corresponding to a number.
|
||||||
|
*
|
||||||
|
* @param num -
|
||||||
|
* multiplier
|
||||||
|
* @return expression denoting the result of multiplying the argument with
|
||||||
|
* the number corresponding to the expression on which the method
|
||||||
|
* was invoked.
|
||||||
|
*/
|
||||||
|
Expression times(Number num);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Multiplication. This method must be invoked on an expression
|
||||||
|
* corresponding to a number.
|
||||||
|
*
|
||||||
|
* @param expr -
|
||||||
|
* expression corresponding to the multiplier
|
||||||
|
* @return expression denoting the result of multiplying the number denoted
|
||||||
|
* by the argument with the number corresponding to the expression
|
||||||
|
* on which the method was invoked.
|
||||||
|
*/
|
||||||
|
Expression times(Expression expr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Absolute value. This method must be invoked on an expression
|
||||||
|
* corresponding to a number.
|
||||||
|
*
|
||||||
|
* @return expression corresponding to the absolute value
|
||||||
|
*/
|
||||||
|
Expression abs();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Square root. This method must be invoked on an expression corresponding
|
||||||
|
* to a number.
|
||||||
|
*
|
||||||
|
* @return expression corresponding to the square root
|
||||||
|
*/
|
||||||
|
Expression sqrt();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modulo operation. This must be invoked on an expression corresponding to
|
||||||
|
* an integer value
|
||||||
|
*
|
||||||
|
* @param num -
|
||||||
|
* integer divisor
|
||||||
|
* @return expression corresponding to the integer remainder of the division
|
||||||
|
* of the integer corresponding to the expression on which the
|
||||||
|
* method was invoked by the argument.
|
||||||
|
*/
|
||||||
|
Expression mod(int num);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modulo operation. This must be invoked on an expression corresponding to
|
||||||
|
* an integer value
|
||||||
|
*
|
||||||
|
* @param expr -
|
||||||
|
* expression corresponding to integer divisor
|
||||||
|
* @return expression corresponding to the integer remainder of the division
|
||||||
|
* of the integer corresponding to the expression on which the
|
||||||
|
* method was invoked by the argument.
|
||||||
|
*/
|
||||||
|
Expression mod(Expression expr);
|
||||||
|
}
|
|
@ -22,14 +22,6 @@ import java.io.Serializable;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
import javax.persistence.OrderByItem;
|
|
||||||
import javax.persistence.PathExpression;
|
|
||||||
import javax.persistence.Predicate;
|
|
||||||
import javax.persistence.PredicateOperand;
|
|
||||||
import javax.persistence.Subquery;
|
|
||||||
import javax.persistence.TrimSpec;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An abstract expression acts as a factory for concrete unary or binary
|
* An abstract expression acts as a factory for concrete unary or binary
|
||||||
* expressions such as ABS() or PLUS().
|
* expressions such as ABS() or PLUS().
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface used for the result of a fetch join.
|
||||||
|
*/
|
||||||
|
public interface FetchJoinObject {
|
||||||
|
}
|
|
@ -20,8 +20,6 @@ package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import static org.apache.openjpa.persistence.query.PathOperator.NAVIGATION;
|
import static org.apache.openjpa.persistence.query.PathOperator.NAVIGATION;
|
||||||
|
|
||||||
import javax.persistence.FetchJoinObject;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes a path used in fetch join. Simply wraps a Navigation Path.
|
* Denotes a path used in fetch join. Simply wraps a Navigation Path.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes e1 >= e2 Expression.
|
* Denotes e1 >= e2 Expression.
|
||||||
*
|
*
|
||||||
|
@ -28,7 +26,10 @@ import javax.persistence.Expression;
|
||||||
*/
|
*/
|
||||||
public class GreaterEqualExpression extends BinaryExpressionPredicate {
|
public class GreaterEqualExpression extends BinaryExpressionPredicate {
|
||||||
public GreaterEqualExpression(Expression op1, Expression op2) {
|
public GreaterEqualExpression(Expression op1, Expression op2) {
|
||||||
super(op1, BinaryConditionalOperator.GREATEREQUAL, BinaryConditionalOperator.LESS, op2);
|
super(op1,
|
||||||
|
BinaryConditionalOperator.GREATEREQUAL,
|
||||||
|
BinaryConditionalOperator.LESS,
|
||||||
|
op2);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes e1 > e2 Expression.
|
* Denotes e1 > e2 Expression.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,8 +1,23 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
import javax.persistence.Subquery;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes e1 IN (e2) Expression.
|
* Denotes e1 IN (e2) Expression.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes INDEX(e) Expression.
|
* Denotes INDEX(e) Expression.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,8 +1,23 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
|
|
||||||
public class IsEmptyExpression extends UnaryExpressionPredicate {
|
public class IsEmptyExpression extends UnaryExpressionPredicate {
|
||||||
public IsEmptyExpression(Expression op) {
|
public IsEmptyExpression(Expression op) {
|
||||||
super(op, UnaryConditionalOperator.ISEMPTY,
|
super(op, UnaryConditionalOperator.ISEMPTY,
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes e IS NULL Expression.
|
* Denotes e IS NULL Expression.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.DomainObject;
|
|
||||||
import static org.apache.openjpa.persistence.query.PathOperator.NAVIGATION;
|
import static org.apache.openjpa.persistence.query.PathOperator.NAVIGATION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes LENGTH(e) Expression.
|
* Denotes LENGTH(e) Expression.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes e1 <= e2 Expression.
|
* Denotes e1 <= e2 Expression.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes e1 < e2 Expression.
|
* Denotes e1 < e2 Expression.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes e1 LIKE e2 Expression.
|
* Denotes e1 LIKE e2 Expression.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes LOCATE(e1, e2, n) Expression.
|
* Denotes LOCATE(e1, e2, n) Expression.
|
||||||
* e1 : string to be located
|
* e1 : string to be located
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Predicate;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logical Predicate combines two predicates with a logical operator.
|
* Logical Predicate combines two predicates with a logical operator.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes LOWER(e) Expression.
|
* Denotes LOWER(e) Expression.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes MAX(e) Expression.
|
* Denotes MAX(e) Expression.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes e1 MEMBER OF e2 Expression.
|
* Denotes e1 MEMBER OF e2 Expression.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes MIN(e) Expression.
|
* Denotes MIN(e) Expression.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes (e1 - e2) Expression.
|
* Denotes (e1 - e2) Expression.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.PathExpression;
|
|
||||||
import static org.apache.openjpa.persistence.query.PathOperator.NAVIGATION;
|
import static org.apache.openjpa.persistence.query.PathOperator.NAVIGATION;
|
||||||
/**
|
/**
|
||||||
* Represents a path resulted by navigation.
|
* Represents a path resulted by navigation.
|
||||||
|
|
|
@ -21,9 +21,6 @@ package org.apache.openjpa.persistence.query;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.persistence.OrderByItem;
|
|
||||||
import javax.persistence.SelectItem;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes NEW fully.qualified.class.name(arg1, arg2,...)
|
* Denotes NEW fully.qualified.class.name(arg1, arg2,...)
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes (e1 != e2) Expression.
|
* Denotes (e1 != e2) Expression.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,18 +18,16 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Query;
|
import org.apache.openjpa.kernel.Query;
|
||||||
import javax.persistence.QueryBuilder;
|
|
||||||
import javax.persistence.QueryDefinition;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An extension of standard JPA Specification interface to add equivalence of
|
* Builds dynamic query
|
||||||
* QueryDefinition and Query and JPQL String.
|
|
||||||
*
|
*
|
||||||
* @author Pinaki Poddar
|
* @author Pinaki Poddar
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface OpenJPAQueryBuilder extends QueryBuilder {
|
public interface OpenJPAQueryBuilder extends QueryBuilder {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a QueryDefinition from the given JPQL String.
|
* Create a QueryDefinition from the given JPQL String.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Predicate;
|
|
||||||
import static org.apache.openjpa.persistence.query.ConditionalOperator.*;
|
import static org.apache.openjpa.persistence.query.ConditionalOperator.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @version $Rev: 721048 $ $Date: 2008-11-26 18:23:43 -0600 (Wed, 26 Nov 2008) $
|
||||||
|
*/
|
||||||
|
@Target({ElementType.METHOD, ElementType.FIELD})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface OrderBy {
|
||||||
|
String value() default "";
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instances of this interface can be used as orderBy arguments.
|
||||||
|
*/
|
||||||
|
public interface OrderByItem {
|
||||||
|
}
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.OrderByItem;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes an item of ORDER BY clause.
|
* Denotes an item of ORDER BY clause.
|
||||||
*
|
*
|
||||||
|
|
|
@ -0,0 +1,117 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for operations over objects reached via paths
|
||||||
|
*/
|
||||||
|
public interface PathExpression extends Expression {
|
||||||
|
/**
|
||||||
|
* Return a path expression corresponding to the referenced attribute. It is
|
||||||
|
* not permitted to invoke this method on a path expression that corresponds
|
||||||
|
* to a multi-valued association or element collection. The path expression
|
||||||
|
* on which this method is invoked must correspond to a class containing the
|
||||||
|
* referenced attribute.
|
||||||
|
*
|
||||||
|
* @param attributeName -
|
||||||
|
* name of the referenced attribute
|
||||||
|
* @return path expression
|
||||||
|
*/
|
||||||
|
PathExpression get(String attributeName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return an expression that corresponds to the type of the entity. This
|
||||||
|
* method can only be invoked on a path expression corresponding to an
|
||||||
|
* entity. It is not permitted to invoke this method on a path expression
|
||||||
|
* that corresponds to a multi-valued association.
|
||||||
|
*
|
||||||
|
* @return expression denoting the entity's type
|
||||||
|
*/
|
||||||
|
Expression type();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return an expression that corresponds to the number of elements
|
||||||
|
* association or element collection corresponding to the path expression.
|
||||||
|
* This method can only be invoked on a path expression that corresponds to
|
||||||
|
* a multi-valued association or to an element collection.
|
||||||
|
*
|
||||||
|
* @return expression denoting the size
|
||||||
|
*/
|
||||||
|
Expression size();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a restriction that the path expression must correspond to an
|
||||||
|
* association or element collection that is empty (has no elements). This
|
||||||
|
* method can only be invoked on a path expression that corresponds to a
|
||||||
|
* multi-valued association or to an element collection.
|
||||||
|
*
|
||||||
|
* @return predicate corresponding to the restriction
|
||||||
|
*/
|
||||||
|
Predicate isEmpty();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify that the avg operation is to be applied. The path expression must
|
||||||
|
* correspond to an attribute of a numeric type. It is not permitted to
|
||||||
|
* invoke this method on a path expression that corresponds to a
|
||||||
|
* multi-valued association or element collection.
|
||||||
|
*
|
||||||
|
* @return the resulting aggregate
|
||||||
|
*/
|
||||||
|
Aggregate avg();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify that the max operation is to be applied. The path expression must
|
||||||
|
* correspond to an attribute of an orderable type. It is not permitted to
|
||||||
|
* invoke this method on a path expression that corresponds to a
|
||||||
|
* multi-valued association or element collection.
|
||||||
|
*
|
||||||
|
* @return the resulting aggregate
|
||||||
|
*/
|
||||||
|
Aggregate max();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify that the min operation is to be applied. The path expression must
|
||||||
|
* correspond to an attribute of an orderable type. It is not permitted to
|
||||||
|
* invoke this method on a path expression that corresponds to a
|
||||||
|
* multi-valued association or element collection.
|
||||||
|
*
|
||||||
|
* @return the resulting aggregate
|
||||||
|
*/
|
||||||
|
Aggregate min();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify that the count operation is to be applied. It is not permitted to
|
||||||
|
* invoke this method on a path expression that corresponds to a
|
||||||
|
* multi-valued association or element collection.
|
||||||
|
*
|
||||||
|
* @return the resulting aggregate
|
||||||
|
*/
|
||||||
|
Aggregate count();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify that the sum operation is to be applied. The path expression must
|
||||||
|
* correspond to an attribute of a numeric type. It is not permitted to
|
||||||
|
* invoke this method on a path expression that corresponds to a
|
||||||
|
* multi-valued association or element collection.
|
||||||
|
*
|
||||||
|
* @return the resulting aggregate
|
||||||
|
*/
|
||||||
|
Aggregate sum();
|
||||||
|
}
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes (e1 + e2) Expression.
|
* Denotes (e1 + e2) Expression.
|
||||||
*
|
*
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface used to define compound predicates.
|
||||||
|
*/
|
||||||
|
public interface Predicate {
|
||||||
|
/**
|
||||||
|
* Creates an AND of the predicate with the argument.
|
||||||
|
*
|
||||||
|
* @param predicate -
|
||||||
|
* A simple or compound predicate
|
||||||
|
* @return the predicate that is the AND of the original simple or compound
|
||||||
|
* predicate and the argument.
|
||||||
|
*/
|
||||||
|
Predicate and(Predicate predicate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an OR of the predicate with the argument.
|
||||||
|
*
|
||||||
|
* @param predicate -
|
||||||
|
* A simple or compound predicate
|
||||||
|
* @return the predicate that is the OR of the original simple or compound
|
||||||
|
* predicate and the argument.
|
||||||
|
*/
|
||||||
|
Predicate or(Predicate predicate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a negation of the predicate with the argument.
|
||||||
|
*
|
||||||
|
* @return the predicate that is the negation of the original simple or
|
||||||
|
* compound predicate.
|
||||||
|
*/
|
||||||
|
Predicate not();
|
||||||
|
}
|
|
@ -0,0 +1,588 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for constructing where-clause and having-clause conditions.
|
||||||
|
* Instances of PredicateOperand are used in constructing predicates passed to
|
||||||
|
* the where or having methods.
|
||||||
|
*/
|
||||||
|
public interface PredicateOperand {
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing equality with the specified argument.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* PredicateOperand instance or parameter
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate equal(PredicateOperand arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing equality with the specified argument.
|
||||||
|
*
|
||||||
|
* @param cls -
|
||||||
|
* entity class
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate equal(Class cls);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing equality with the specified argument.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* numeric
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate equal(Number arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing equality with the specified argument.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* string value
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate equal(String arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing equality with the specified argument.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* boolean value
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate equal(boolean arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing equality with the specified argument.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* date
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate equal(Date arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing equality with the specified argument.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* calendar
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate equal(Calendar arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing equality with the specified argument.
|
||||||
|
*
|
||||||
|
* @param e -
|
||||||
|
* enum
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate equal(Enum<?> e);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing inequality with the specified argument.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* PredicateOperand instance or parameter
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate notEqual(PredicateOperand arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing inequality with the specified argument.
|
||||||
|
*
|
||||||
|
* @param cls -
|
||||||
|
* entity class
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate notEqual(Class cls);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing inequality with the specified argument.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* numberic value
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate notEqual(Number arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing inequality with the specified argument.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* string value
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate notEqual(String arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing inequality with the specified argument.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* boolean value
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate notEqual(boolean arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing inequality with the specified argument.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* date
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate notEqual(Date arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing inequality with the specified argument.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* calendar
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate notEqual(Calendar arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing inequality with the specified argument.
|
||||||
|
*
|
||||||
|
* @param e -
|
||||||
|
* enum
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate notEqual(Enum<?> e);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand is greater
|
||||||
|
* than the argument.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* PredicateOperand instance or parameter
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate greaterThan(PredicateOperand arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand is greater
|
||||||
|
* than the argument.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* numeric
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate greaterThan(Number arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand is greater
|
||||||
|
* than the argument.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* string
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate greaterThan(String arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand is greater
|
||||||
|
* than the argument.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* date
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate greaterThan(Date arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand is greater
|
||||||
|
* than the argument.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* calendar
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate greaterThan(Calendar arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand is greater
|
||||||
|
* than or equal to the argument.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* PredicateOperand instance or parameter
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate greaterEqual(PredicateOperand arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand is greater
|
||||||
|
* than or equal to the argument.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* numeric
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate greaterEqual(Number arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand is greater
|
||||||
|
* than or equal to the argument.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* string
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate greaterEqual(String arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand is greater
|
||||||
|
* than or equal to the argument.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* date
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate greaterEqual(Date arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand is greater
|
||||||
|
* than or equal to the argument.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* calendar
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate greaterEqual(Calendar arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand is less than
|
||||||
|
* the argument.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* PredicateOperand instance or parameter
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate lessThan(PredicateOperand arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand is less than
|
||||||
|
* the argument.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* numeric
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate lessThan(Number arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand is less than
|
||||||
|
* the argument.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* string
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate lessThan(String arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand is less than
|
||||||
|
* the argument.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* date
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate lessThan(Date arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand is less than
|
||||||
|
* the argument.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* calendar
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate lessThan(Calendar arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand is less than
|
||||||
|
* or equal to the argument.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* PredicateOperand instance or parameter
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate lessEqual(PredicateOperand arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand is less than
|
||||||
|
* or equal to the argument.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* numeric
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate lessEqual(Number arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand is less than
|
||||||
|
* or equal to the argument.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* string
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate lessEqual(String arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand is less than
|
||||||
|
* or equal to the argument.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* date
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate lessEqual(Date arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand is less than
|
||||||
|
* or equal to the argument.
|
||||||
|
*
|
||||||
|
* @param arg -
|
||||||
|
* calendar
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate lessEqual(Calendar arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand lies between
|
||||||
|
* (inclusive) the two arguments.
|
||||||
|
*
|
||||||
|
* @param arg1 -
|
||||||
|
* PredicateOperand instance or parameter
|
||||||
|
* @param arg2 -
|
||||||
|
* PredicateOperand instance or parameter
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate between(PredicateOperand arg1, PredicateOperand arg2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand lies between
|
||||||
|
* (inclusive) the two arguments.
|
||||||
|
*
|
||||||
|
* @param arg1 -
|
||||||
|
* PredicateOperand instance or parameter
|
||||||
|
* @param arg2 -
|
||||||
|
* numeric
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate between(PredicateOperand arg1, Number arg2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand lies between
|
||||||
|
* (inclusive) the two arguments.
|
||||||
|
*
|
||||||
|
* @param arg1 -
|
||||||
|
* numeric
|
||||||
|
* @param arg2 -
|
||||||
|
* PredicateOperand instance or parameter
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate between(Number arg1, PredicateOperand arg2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand lies between
|
||||||
|
* (inclusive) the two arguments.
|
||||||
|
*
|
||||||
|
* @param arg1 -
|
||||||
|
* numeric
|
||||||
|
* @param arg2 -
|
||||||
|
* numeric
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate between(Number arg1, Number arg2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand lies between
|
||||||
|
* (inclusive) the two arguments.
|
||||||
|
*
|
||||||
|
* @param arg1 -
|
||||||
|
* PredicateOperand instance or parameter
|
||||||
|
* @param arg2 -
|
||||||
|
* string
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate between(PredicateOperand arg1, String arg2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand lies between
|
||||||
|
* (inclusive) the two arguments.
|
||||||
|
*
|
||||||
|
* @param arg1 -
|
||||||
|
* string
|
||||||
|
* @param arg2 -
|
||||||
|
* PredicateOperand instance or parameter
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate between(String arg1, PredicateOperand arg2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand lies between
|
||||||
|
* (inclusive) the two arguments.
|
||||||
|
*
|
||||||
|
* @param arg1 -
|
||||||
|
* string
|
||||||
|
* @param arg2 -
|
||||||
|
* string
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate between(String arg1, String arg2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand lies between
|
||||||
|
* (inclusive) the two arguments.
|
||||||
|
*
|
||||||
|
* @param arg1 -
|
||||||
|
* PredicateOperand instance or parameter
|
||||||
|
* @param arg2 -
|
||||||
|
* date
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate between(PredicateOperand arg1, Date arg2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand lies between
|
||||||
|
* (inclusive) the two arguments.
|
||||||
|
*
|
||||||
|
* @param arg1 -
|
||||||
|
* date
|
||||||
|
* @param arg2 -
|
||||||
|
* PredicateOperand instance or parameter
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate between(Date arg1, PredicateOperand arg2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand lies between
|
||||||
|
* (inclusive) the two arguments.
|
||||||
|
*
|
||||||
|
* @param arg1 -
|
||||||
|
* date
|
||||||
|
* @param arg2 -
|
||||||
|
* date
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate between(Date arg1, Date arg2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand lies between
|
||||||
|
* (inclusive) the two arguments.
|
||||||
|
*
|
||||||
|
* @param arg1 -
|
||||||
|
* PredicateOperand instance or parameter
|
||||||
|
* @param arg2 -
|
||||||
|
* calendar
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate between(PredicateOperand arg1, Calendar arg2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand lies between
|
||||||
|
* (inclusive) the two arguments.
|
||||||
|
*
|
||||||
|
* @param arg1 -
|
||||||
|
* calendar
|
||||||
|
* @param arg2 -
|
||||||
|
* PredicateOperand instance or parameter
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate between(Calendar arg1, PredicateOperand arg2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand lies between
|
||||||
|
* (inclusive) the two arguments.
|
||||||
|
*
|
||||||
|
* @param arg1 -
|
||||||
|
* calendar
|
||||||
|
* @param arg2 -
|
||||||
|
* calendar
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate between(Calendar arg1, Calendar arg2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand satisfies the
|
||||||
|
* given pattern.
|
||||||
|
*
|
||||||
|
* @param pattern
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate like(PredicateOperand pattern);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand satisfies the
|
||||||
|
* given pattern.
|
||||||
|
*
|
||||||
|
* @param pattern
|
||||||
|
* @param escapeChar
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate like(PredicateOperand pattern, PredicateOperand escapeChar);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand satisfies the
|
||||||
|
* given pattern.
|
||||||
|
*
|
||||||
|
* @param pattern
|
||||||
|
* @param escapeChar
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate like(PredicateOperand pattern, char escapeChar);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand satisfies the
|
||||||
|
* given pattern.
|
||||||
|
*
|
||||||
|
* @param pattern
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate like(String pattern);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand satisfies the
|
||||||
|
* given pattern.
|
||||||
|
*
|
||||||
|
* @param pattern
|
||||||
|
* @param escapeChar
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate like(String pattern, PredicateOperand escapeChar);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate for testing whether the PredicateOperand satisfies the
|
||||||
|
* given pattern.
|
||||||
|
*
|
||||||
|
* @param pattern
|
||||||
|
* @param escapeChar
|
||||||
|
* @return conditional predicate
|
||||||
|
*/
|
||||||
|
Predicate like(String pattern, char escapeChar);
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Factory interface for query definition objects
|
||||||
|
*/
|
||||||
|
public interface QueryBuilder {
|
||||||
|
/**
|
||||||
|
* Create an uninitialized query definition object.
|
||||||
|
*
|
||||||
|
* @return query definition instance
|
||||||
|
*/
|
||||||
|
QueryDefinition createQueryDefinition();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a query definition object with the given root. The root must be an
|
||||||
|
* entity class.
|
||||||
|
*
|
||||||
|
* @param cls -
|
||||||
|
* an entity class
|
||||||
|
* @return root domain object
|
||||||
|
*/
|
||||||
|
DomainObject createQueryDefinition(Class root);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a query definition object whose root is derived from a domain
|
||||||
|
* object of the containing query. Provides support for correlated
|
||||||
|
* subqueries. Joins against the resulting domain object do not affect the
|
||||||
|
* query domain of the containing query. The path expression must correspond
|
||||||
|
* to an entity class. The path expression must not be a domain object of
|
||||||
|
* the containing query.
|
||||||
|
*
|
||||||
|
* @param path -
|
||||||
|
* path expression corresponding to the domain object used to
|
||||||
|
* derive the subquery root.
|
||||||
|
* @return the subquery DomainObject
|
||||||
|
*/
|
||||||
|
DomainObject createSubqueryDefinition(PathExpression path);
|
||||||
|
}
|
|
@ -18,11 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.DomainObject;
|
import org.apache.openjpa.kernel.Query;
|
||||||
import javax.persistence.PathExpression;
|
|
||||||
import javax.persistence.Query;
|
|
||||||
import javax.persistence.QueryDefinition;
|
|
||||||
|
|
||||||
import org.apache.openjpa.meta.MetaDataRepository;
|
import org.apache.openjpa.meta.MetaDataRepository;
|
||||||
import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
|
import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,556 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for construction of query definitions
|
||||||
|
*/
|
||||||
|
public interface QueryDefinition extends Subquery {
|
||||||
|
/**
|
||||||
|
* Add a query root corresponding to the given entity, forming a cartesian
|
||||||
|
* product with any existing roots. The domain object that is returned is
|
||||||
|
* bound as a component of the given query. The argument must be an entity
|
||||||
|
* class.
|
||||||
|
*
|
||||||
|
* @param cls -
|
||||||
|
* an entity class
|
||||||
|
* @return DomainObject corresponding to the specified entity class.
|
||||||
|
*/
|
||||||
|
DomainObject addRoot(Class cls);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a root derived from a domain object of the containing query
|
||||||
|
* definition to a query definition used as a subquery. Provides support for
|
||||||
|
* correlated subqueries. Joins against the resulting domain object do not
|
||||||
|
* affect the query domain of the containing query. The path expression must
|
||||||
|
* correspond to an entity class. The path expression must not be a domain
|
||||||
|
* object of the containing query.
|
||||||
|
*
|
||||||
|
* @param path -
|
||||||
|
* path expression corresponding to the domain object used to
|
||||||
|
* derive the subquery root.
|
||||||
|
* @return the subquery DomainObject
|
||||||
|
*/
|
||||||
|
DomainObject addSubqueryRoot(PathExpression path);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify the objects / values to be returned. Replaces the previous select
|
||||||
|
* list, if any. If no select items are specified and there is only one
|
||||||
|
* query root, the root entity is assumed to be the result.
|
||||||
|
*
|
||||||
|
* @param selectItems -
|
||||||
|
* one or more SelectItem instances
|
||||||
|
* @return the modified query definition instance
|
||||||
|
*/
|
||||||
|
QueryDefinition select(SelectItem... selectItems);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify the objects / values to be returned. Replaces the previous select
|
||||||
|
* list, if any. If no select items are specified and there is only one
|
||||||
|
* query root, the root entity is assumed to be the result.
|
||||||
|
*
|
||||||
|
* @param selectItemList -
|
||||||
|
* a list containing one or more SelectItem instances
|
||||||
|
* @return the modified query definition instance
|
||||||
|
*/
|
||||||
|
QueryDefinition select(List<SelectItem> selectItemList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify the objects / values to be returned. Duplicate results will be
|
||||||
|
* eliminated. Replaces the previous select list, if any. If no select items
|
||||||
|
* are specified and there is only one query root, the root entity is
|
||||||
|
* assumed to be the result.
|
||||||
|
*
|
||||||
|
* @param selectItems -
|
||||||
|
* one or more SelectItem instances
|
||||||
|
* @return the modified query definition instance
|
||||||
|
*/
|
||||||
|
QueryDefinition selectDistinct(SelectItem... selectItems);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify the objects / values to be returned. Duplicate results will be
|
||||||
|
* eliminated. Replaces the previous select list, if any. If no select items
|
||||||
|
* are specified, and there is only one query root, the root entity is
|
||||||
|
* assumed to be the result. is assumed to be the result.
|
||||||
|
*
|
||||||
|
* @param selectItemList -
|
||||||
|
* a list containing one or more SelectItem instances
|
||||||
|
* @return the modified query definition instance
|
||||||
|
*/
|
||||||
|
QueryDefinition selectDistinct(List<SelectItem> selectItemList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modifies the query definition to restrict the result of the query
|
||||||
|
* according to the specified predicate. Replaces the previously added
|
||||||
|
* restriction(s), if any.
|
||||||
|
*
|
||||||
|
* @param predicate -
|
||||||
|
* a simple or compound conditional predicate
|
||||||
|
* @return the modified QueryDefinition instance
|
||||||
|
*/
|
||||||
|
QueryDefinition where(Predicate predicate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify the items of the select list that are used in ordering the query
|
||||||
|
* results. Replaces the previous order-by list, if any.
|
||||||
|
*
|
||||||
|
* @param orderByItems -
|
||||||
|
* one or more OrderByItem instances
|
||||||
|
* @return the modified QueryDefinition instance
|
||||||
|
*/
|
||||||
|
QueryDefinition orderBy(OrderByItem... orderByItems);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify the items of the select list that are used in ordering the query
|
||||||
|
* results. Replaces the previous order-by list, if any.
|
||||||
|
*
|
||||||
|
* @param orderByItemList -
|
||||||
|
* a list containing one or more OrderByItem instances
|
||||||
|
* @return the modified QueryDefinition instance
|
||||||
|
*/
|
||||||
|
QueryDefinition orderBy(List<OrderByItem> orderByItemList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify the items that are used to form groups over the query results.
|
||||||
|
* Replaces the previous group-by list, if any.
|
||||||
|
*
|
||||||
|
* @param pathExprs
|
||||||
|
* @return the modified QueryDefinition instance
|
||||||
|
*/
|
||||||
|
QueryDefinition groupBy(PathExpression... pathExprs);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify the items that are used to form groups over the query results.
|
||||||
|
* Replaces the previous group-by list, if any.
|
||||||
|
*
|
||||||
|
* @param pathExprList
|
||||||
|
* @return the modified QueryDefinition instance
|
||||||
|
*/
|
||||||
|
QueryDefinition groupBy(List<PathExpression> pathExprList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify the restrictions over the groups of a query. Replaces the
|
||||||
|
* previous having restriction(s), if any.
|
||||||
|
*
|
||||||
|
* @param predicate
|
||||||
|
* @return the modified QueryDefinition Instance
|
||||||
|
*/
|
||||||
|
QueryDefinition having(Predicate predicate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify that a constructor for the given class is to be applied to the
|
||||||
|
* corresponding query results after the query is executed. The class must
|
||||||
|
* have a constructor that accepts the Java argument types corresponding to
|
||||||
|
* the given select items.
|
||||||
|
*
|
||||||
|
* @param cls -
|
||||||
|
* a class with the correponding constructor
|
||||||
|
* @param args -
|
||||||
|
* select items that correspond to result types that are valid as
|
||||||
|
* arguments to the constructor
|
||||||
|
* @result SelectItem instance representing the constructor
|
||||||
|
*/
|
||||||
|
SelectItem newInstance(Class cls, SelectItem... args);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the query definition instance as a subquery in an exists predicate.
|
||||||
|
*
|
||||||
|
* @return the resulting predicate
|
||||||
|
*/
|
||||||
|
Predicate exists();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the query definition object in a subquery in an all expression.
|
||||||
|
*
|
||||||
|
* @return the resulting Subquery
|
||||||
|
*/
|
||||||
|
Subquery all();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the query definition object in a subquery in an any expression.
|
||||||
|
*
|
||||||
|
* @return the resulting Subquery
|
||||||
|
*/
|
||||||
|
Subquery any();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the query definition object in a subquery in a some expression.
|
||||||
|
*
|
||||||
|
* @return the resulting Subquery
|
||||||
|
*/
|
||||||
|
Subquery some();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an empty general case expression. A general case expression is of
|
||||||
|
* the form:
|
||||||
|
* <p/>
|
||||||
|
* generalCase() .when(conditional-predicate).then(scalar-expression)
|
||||||
|
* .when(conditional-predicate).then(scalar-expression) ...
|
||||||
|
* .elseCase(scalar-expression)
|
||||||
|
*
|
||||||
|
* @return empty general case expression
|
||||||
|
*/
|
||||||
|
CaseExpression generalCase();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a simple case expression with the given case operand. A simple
|
||||||
|
* case expression is of the form:
|
||||||
|
* <p/>
|
||||||
|
* simpleCase(case-operand) .when(scalar-expression).then(scalar-expression)
|
||||||
|
* .when(scalar-expression).then(scalar-expression) ...
|
||||||
|
* .elseCase(scalar-expression)
|
||||||
|
*
|
||||||
|
* @param caseOperand -
|
||||||
|
* expression used for testing against the when scalar
|
||||||
|
* expressions
|
||||||
|
* @return case expression with the given case operand
|
||||||
|
*/
|
||||||
|
CaseExpression simpleCase(Expression caseOperand);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a simple case expression with the given case operand. A simple
|
||||||
|
* case expression is of the form:
|
||||||
|
* <p/>
|
||||||
|
* simpleCase(case-operand) .when(scalar-expression).then(scalar-expression)
|
||||||
|
* .when(scalar-expression).then(scalar-expression) ...
|
||||||
|
* .elseCase(scalar-expression)
|
||||||
|
*
|
||||||
|
* @param caseOperand -
|
||||||
|
* numeric value used for testing against the when scalar
|
||||||
|
* expressions
|
||||||
|
* @return case expression with the given case operand
|
||||||
|
*/
|
||||||
|
CaseExpression simpleCase(Number caseOperand);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a simple case expression with the given case operand. A simple
|
||||||
|
* case expression is of the form:
|
||||||
|
* <p/>
|
||||||
|
* simpleCase(case-operand) .when(scalar-expression).then(scalar-expression)
|
||||||
|
* .when(scalar-expression).then(scalar-expression) ...
|
||||||
|
* .elseCase(scalar-expression)
|
||||||
|
*
|
||||||
|
* @param caseOperand -
|
||||||
|
* value used for testing against the when scalar expressions
|
||||||
|
* @return case expression with the given case operand
|
||||||
|
*/
|
||||||
|
CaseExpression simpleCase(String caseOperand);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a simple case expression with the given case operand. A simple
|
||||||
|
* case expression is of the form:
|
||||||
|
* <p/>
|
||||||
|
* simpleCase(case-operand) .when(scalar-expression).then(scalar-expression)
|
||||||
|
* .when(scalar-expression).then(scalar-expression) ...
|
||||||
|
* .elseCase(scalar-expression)
|
||||||
|
*
|
||||||
|
* @param caseOperand -
|
||||||
|
* value used for testing against the when scalar expressions
|
||||||
|
* @return case expression with the given case operand
|
||||||
|
*/
|
||||||
|
CaseExpression simpleCase(Date caseOperand);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a simple case expression with the given case operand. A simple
|
||||||
|
* case expression is of the form:
|
||||||
|
* <p/>
|
||||||
|
* simpleCase(case-operand) .when(scalar-expression).then(scalar-expression)
|
||||||
|
* .when(scalar-expression).then(scalar-expression) ...
|
||||||
|
* .elseCase(scalar-expression)
|
||||||
|
*
|
||||||
|
* @param caseOperand -
|
||||||
|
* value used for testing against the when scalar expressions
|
||||||
|
* @return case expression with the given case operand
|
||||||
|
*/
|
||||||
|
CaseExpression simpleCase(Calendar caseOperand);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a simple case expression with the given case operand. A simple
|
||||||
|
* case expression is of the form:
|
||||||
|
* <p/>
|
||||||
|
* simpleCase(case-operand) .when(scalar-expression).then(scalar-expression)
|
||||||
|
* .when(scalar-expression).then(scalar-expression) ...
|
||||||
|
* .elseCase(scalar-expression)
|
||||||
|
*
|
||||||
|
* @param caseOperand -
|
||||||
|
* value used for testing against the when scalar expressions
|
||||||
|
* @return case expression with the given case operand
|
||||||
|
*/
|
||||||
|
CaseExpression simpleCase(Class caseOperand);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a simple case expression with the given case operand. A simple
|
||||||
|
* case expression is of the form:
|
||||||
|
* <p/>
|
||||||
|
* simpleCase(case-operand) .when(scalar-expression).then(scalar-expression)
|
||||||
|
* .when(scalar-expression).then(scalar-expression) ...
|
||||||
|
* .elseCase(scalar-expression)
|
||||||
|
*
|
||||||
|
* @param caseOperand -
|
||||||
|
* value used for testing against the when scalar expressions
|
||||||
|
* @return case expression with the given case operand
|
||||||
|
*/
|
||||||
|
CaseExpression simpleCase(Enum<?> caseOperand);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* coalesce This is equivalent to a case expression that returns null if all
|
||||||
|
* its arguments evaluate to null, and the value of its first non-null
|
||||||
|
* argument otherwise.
|
||||||
|
*
|
||||||
|
* @param exp -
|
||||||
|
* expressions to be used for testing against null
|
||||||
|
* @return Expression corresponding to the given coalesce expression
|
||||||
|
*/
|
||||||
|
Expression coalesce(Expression... exp);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* coalesce This is equivalent to a case expression that returns null if all
|
||||||
|
* its arguments evaluate to null, and the value of its first non-null
|
||||||
|
* argument otherwise.
|
||||||
|
*
|
||||||
|
* @param exp -
|
||||||
|
* expressions to be used for testing against null
|
||||||
|
* @return Expression corresponding to the given coalesce expression
|
||||||
|
*/
|
||||||
|
Expression coalesce(String... exp);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* coalesce This is equivalent to a case expression that returns null if all
|
||||||
|
* its arguments evaluate to null, and the value of its first non-null
|
||||||
|
* argument otherwise.
|
||||||
|
*
|
||||||
|
* @param exp -
|
||||||
|
* expressions to be used for testing against null
|
||||||
|
* @return Expression corresponding to the given coalesce expression
|
||||||
|
*/
|
||||||
|
Expression coalesce(Date... exp);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* coalesce This is equivalent to a case expression that returns null if all
|
||||||
|
* its arguments evaluate to null, and the value of its first non-null
|
||||||
|
* argument otherwise.
|
||||||
|
*
|
||||||
|
* @param exp -
|
||||||
|
* expressions to be used for testing against null
|
||||||
|
* @return Expression corresponding to the given coalesce expression
|
||||||
|
*/
|
||||||
|
Expression coalesce(Calendar... exp);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* nullif This is equivalent to a case expression that tests whether its
|
||||||
|
* arguments are equal, returning null if they are and the value of the
|
||||||
|
* first expression if they are not.
|
||||||
|
*
|
||||||
|
* @param exp1
|
||||||
|
* @param exp2
|
||||||
|
* @return Expression corresponding to the given nullif expression
|
||||||
|
*/
|
||||||
|
Expression nullif(Expression exp1, Expression exp2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* nullif This is equivalent to a case expression that tests whether its
|
||||||
|
* arguments are equal, returning null if they are and the value of the
|
||||||
|
* first expression if they are not.
|
||||||
|
*
|
||||||
|
* @param arg1
|
||||||
|
* @param arg2
|
||||||
|
* @return Expression corresponding to the given nullif expression
|
||||||
|
*/
|
||||||
|
Expression nullif(Number arg1, Number arg2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* nullif This is equivalent to a case expression that tests whether its
|
||||||
|
* arguments are equal, returning null if they are and the value of the
|
||||||
|
* first expression if they are not.
|
||||||
|
*
|
||||||
|
* @param arg1
|
||||||
|
* @param arg2 Criteria API Java Persistence 2.0, Public Review Draft
|
||||||
|
* Criteria API Interfaces 10/31/08 158 JSR-317 Public Review
|
||||||
|
* Draft Sun Microsystems, Inc.
|
||||||
|
* @return Expression corresponding to the given nullif expression
|
||||||
|
*/
|
||||||
|
Expression nullif(String arg1, String arg2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* nullif This is equivalent to a case expression that tests whether its
|
||||||
|
* arguments are equal, returning null if they are and the value of the
|
||||||
|
* first expression if they are not.
|
||||||
|
*
|
||||||
|
* @param arg1
|
||||||
|
* @param arg2
|
||||||
|
* @return Expression corresponding to the given nullif expression
|
||||||
|
*/
|
||||||
|
Expression nullif(Date arg1, Date arg2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* nullif This is equivalent to a case expression that tests whether its
|
||||||
|
* arguments are equal, returning null if they are and the value of the
|
||||||
|
* first expression if they are not.
|
||||||
|
*
|
||||||
|
* @param arg1
|
||||||
|
* @param arg2
|
||||||
|
* @return Expression corresponding to the given nullif expression
|
||||||
|
*/
|
||||||
|
Expression nullif(Calendar arg1, Calendar arg2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* nullif This is equivalent to a case expression that tests whether its
|
||||||
|
* arguments are equal, returning null if they are and the value of the
|
||||||
|
* first expression if they are not.
|
||||||
|
*
|
||||||
|
* @param arg1
|
||||||
|
* @param arg2
|
||||||
|
* @return Expression corresponding to the given nullif expression
|
||||||
|
*/
|
||||||
|
Expression nullif(Class arg1, Class arg2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* nullif This is equivalent to a case expression that tests whether its
|
||||||
|
* arguments are equal, returning null if they are and the value of the
|
||||||
|
* first expression if they are not.
|
||||||
|
*
|
||||||
|
* @param arg1
|
||||||
|
* @param arg2
|
||||||
|
* @return Expression corresponding to the given nullif expression
|
||||||
|
*/
|
||||||
|
Expression nullif(Enum<?> arg1, Enum<?> arg2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a predicate value from the given boolean.
|
||||||
|
*
|
||||||
|
* @param b boolean value
|
||||||
|
* @return a true or false predicate
|
||||||
|
*/
|
||||||
|
Predicate predicate(boolean b);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an Expression corresponding to the current time on the database
|
||||||
|
* server at the time of query execution.
|
||||||
|
*
|
||||||
|
* @return the corresponding Expression
|
||||||
|
*/
|
||||||
|
Expression currentTime();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an Expression corresponding to the current date on the database
|
||||||
|
* server at the time of query execution.
|
||||||
|
*
|
||||||
|
* @return the corresponding Expression
|
||||||
|
*/
|
||||||
|
Expression currentDate();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an Expression corresponding to the current timestamp on the
|
||||||
|
* database server at the time of query execution.
|
||||||
|
*
|
||||||
|
* @return the corresponding Expression
|
||||||
|
*/
|
||||||
|
Expression currentTimestamp();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an Expression corresponding to a String value.
|
||||||
|
*
|
||||||
|
* @param s -
|
||||||
|
* string value
|
||||||
|
* @return the corresponding Expression literal
|
||||||
|
*/
|
||||||
|
Expression literal(String s);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an Expression corresponding to a numeric value.
|
||||||
|
*
|
||||||
|
* @param n -
|
||||||
|
* numeric value
|
||||||
|
* @return the corresponding Expression literal
|
||||||
|
*/
|
||||||
|
Expression literal(Number n);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an Expression corresponding to a boolean value.
|
||||||
|
*
|
||||||
|
* @param b -
|
||||||
|
* boolean value
|
||||||
|
* @return the corresponding Expression literal
|
||||||
|
*/
|
||||||
|
Expression literal(boolean b);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an Expression corresponding to a Calendar value.
|
||||||
|
*
|
||||||
|
* @param c -
|
||||||
|
* Calendar value
|
||||||
|
* @return the corresponding Expression literal
|
||||||
|
*/
|
||||||
|
Expression literal(Calendar c);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an Expression corresponding to a Date value.
|
||||||
|
*
|
||||||
|
* @param d -
|
||||||
|
* Date value
|
||||||
|
* @return the corresponding Expression literal
|
||||||
|
*/
|
||||||
|
Expression literal(Date d);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an Expression corresponding to a character value.
|
||||||
|
*
|
||||||
|
* @param character value
|
||||||
|
* @return the corresponding Expression literal
|
||||||
|
*/
|
||||||
|
Expression literal(char c);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an Expression corresponding to an entity class.
|
||||||
|
*
|
||||||
|
* @param cls -
|
||||||
|
* entity class
|
||||||
|
* @return the corresponding Expression literal
|
||||||
|
*/
|
||||||
|
Expression literal(Class cls);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an Expression corresponding to an enum.
|
||||||
|
*
|
||||||
|
* @param e -
|
||||||
|
* enum
|
||||||
|
* @return the corresponding Expression literal
|
||||||
|
*/
|
||||||
|
Expression literal(Enum<?> e);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an Expression corresponding to a null value.
|
||||||
|
*
|
||||||
|
* @return the corresponding Expression literal
|
||||||
|
*/
|
||||||
|
Expression nullLiteral();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify use of a parameter of the given name.
|
||||||
|
*
|
||||||
|
* @param parameter name
|
||||||
|
* @return an Expression corresponding to a named parameter
|
||||||
|
*/
|
||||||
|
Expression param(String name);
|
||||||
|
}
|
|
@ -29,16 +29,6 @@ import java.util.Date;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.persistence.CaseExpression;
|
|
||||||
import javax.persistence.DomainObject;
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
import javax.persistence.OrderByItem;
|
|
||||||
import javax.persistence.PathExpression;
|
|
||||||
import javax.persistence.Predicate;
|
|
||||||
import javax.persistence.QueryDefinition;
|
|
||||||
import javax.persistence.SelectItem;
|
|
||||||
import javax.persistence.Subquery;
|
|
||||||
|
|
||||||
import org.apache.openjpa.lib.util.Localizer;
|
import org.apache.openjpa.lib.util.Localizer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Subquery;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An expression resulting from operation on a query itself. Can be used as a
|
* An expression resulting from operation on a query itself. Can be used as a
|
||||||
* subquery clause in a parent query.
|
* subquery clause in a parent query.
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes a range used by e1 BETWEEN x AND y operation.
|
* Denotes a range used by e1 BETWEEN x AND y operation.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.DomainObject;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes root domain instance representing a persistent type.
|
* Denotes root domain instance representing a persistent type.
|
||||||
*
|
*
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SelectItem instances are used in specifying the query's select list.
|
||||||
|
* <p/>
|
||||||
|
* The methods of this interface are used to define arguments that can be passed
|
||||||
|
* to the orderBy method for use in ordering selected items of the query result.
|
||||||
|
*/
|
||||||
|
public interface SelectItem extends OrderByItem {
|
||||||
|
/**
|
||||||
|
* Return an OrderByItem referencing the SelectItem and specifying ascending
|
||||||
|
* ordering. The SelectItem must correspond to an orderable value.
|
||||||
|
*
|
||||||
|
* @return order-by item
|
||||||
|
*/
|
||||||
|
OrderByItem asc();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return an OrderByItem referencing the SelectItem and specifying
|
||||||
|
* descending ordering. The SelectItem must correspond to an orderable
|
||||||
|
* value.
|
||||||
|
*
|
||||||
|
* @return order-by item
|
||||||
|
*/
|
||||||
|
OrderByItem desc();
|
||||||
|
}
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes SIZE(e) Expression.
|
* Denotes SIZE(e) Expression.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Subquery;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes SOME(Subquery) Expression.
|
* Denotes SOME(Subquery) Expression.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes SQRT(e) Expression.
|
* Denotes SQRT(e) Expression.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes SUBSTR(a,i1,i2) Expression.
|
* Denotes SUBSTR(a,i1,i2) Expression.
|
||||||
*
|
*
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instances of this interface can be used as subqueries.
|
||||||
|
*/
|
||||||
|
public interface Subquery extends PredicateOperand {
|
||||||
|
}
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes SUM(e) Expression.
|
* Denotes SUM(e) Expression.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes (e1*e2) Expression.
|
* Denotes (e1*e2) Expression.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,9 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
import javax.persistence.TrimSpec;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes TRIM(e1,x) Expression.
|
* Denotes TRIM(e1,x) Expression.
|
||||||
*
|
*
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to specify the trimming of strings
|
||||||
|
*/
|
||||||
|
public enum TrimSpec {
|
||||||
|
LEADING, TRAILING, BOTH
|
||||||
|
}
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes TYPE(e) Expression.
|
* Denotes TYPE(e) Expression.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,9 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
import javax.persistence.Predicate;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unary Predicate results from an operator on an Expression.
|
* Unary Predicate results from an operator on an Expression.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes (-e) Expression.
|
* Denotes (-e) Expression.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,9 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Aggregate;
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
class UnaryOperatorExpression extends ExpressionImpl implements Aggregate {
|
class UnaryOperatorExpression extends ExpressionImpl implements Aggregate {
|
||||||
protected final Expression _e;
|
protected final Expression _e;
|
||||||
protected final UnaryFunctionalOperator _op;
|
protected final UnaryFunctionalOperator _op;
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes UPPER(e) Expression.
|
* Denotes UPPER(e) Expression.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,10 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.openjpa.persistence.query;
|
package org.apache.openjpa.persistence.query;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import javax.persistence.Expression;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A expression that holds an array of Expressions. Used as operand for
|
* A expression that holds an array of Expressions. Used as operand for
|
||||||
* CONCAT(e1,e2,e3,...), for example. Different than {@link ArrayExpression}
|
* CONCAT(e1,e2,e3,...), for example. Different than {@link ArrayExpression}
|
||||||
|
|
Loading…
Reference in New Issue