openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Sutter" <kwsut...@gmail.com>
Subject Re: svn commit: r723553 [1/3] - in /openjpa/trunk: openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/ openjpa-persistence/src/main/java/org/apache/openjpa/persistence/ openjpa-persistence/src/main/java/org/apache/openjpa/
Date Fri, 05 Dec 2008 15:59:22 GMT
Pinaki,
Wow, somebody has been busy...  :-)  Nice chunk of work!  I haven't taken
the time to review anything yet, but it sure is nice to see the development
activity.  Thank you!

Kevin

On Thu, Dec 4, 2008 at 7:37 PM, <ppoddar@apache.org> wrote:

> Author: ppoddar
> Date: Thu Dec  4 17:37:13 2008
> New Revision: 723553
>
> URL: http://svn.apache.org/viewvc?rev=723553&view=rev
> Log:
> OPENJPA-806: Initial Criteria API implementation.
>
> Added:
>
>  openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/
>
>  openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Address.java
>
>  openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Contact.java
>
>  openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Contractor.java
>
>  openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Course.java
>
>  openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/CreditCard.java
>
>  openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Customer.java
>
>  openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Department.java
>
>  openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Employee.java
>
>  openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Exempt.java
>
>  openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Item.java
>
>  openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Manager.java
>
>  openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Order.java
>
>  openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Person.java
>
>  openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Phone.java
>
>  openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/StringComparison.java
>
>  openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/TestCriteria.java
>
>  openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/VideoStore.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AbsExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AbstractDomainObject.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AbstractPath.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AliasContext.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AllExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AndPredicate.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AnyExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AverageExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/BetweenExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/BinaryConditionalOperator.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/BinaryExpressionPredicate.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/BinaryFunctionalOperator.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/BinaryOperatorExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/CaseExpressionImpl.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/ConditionalOperator.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/ConstantExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/CountExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/CurrentTimeExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/DistinctExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/DividedByExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/ElseExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/EntryExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/EqualExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/ExistsExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/ExpressionImpl.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/FetchPath.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/GreaterEqualExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/GreaterThanExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/InExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/IndexExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/IsEmptyExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/IsNullExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/JPQLHelper.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/JoinPath.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/KeyExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/LengthExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/LessEqualExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/LessThanExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/LikeExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/LiteralExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/LocateExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/LogicalPredicate.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/LowerExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/MaxExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/MemberOfExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/MinExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/MinusExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/ModExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/NavigationPath.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/NewInstance.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/NotEqualExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/OperatorPath.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/OrPredicate.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/OrderableItem.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/ParameterExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/PathOperator.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/PlusExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/QueryBuilderImpl.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/QueryDefinitionImpl.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/QueryExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/RangeExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/RootPath.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/Selectable.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/SizeExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/SomeExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/SquareRootExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/SubStringExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/SumExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/TimesExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/ToUpperExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/TrimExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/TypeExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/UnaryConditionalOperator.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/UnaryExpressionPredicate.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/UnaryFunctionalOperator.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/UnaryMinusExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/UnaryOperator.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/UnaryOperatorExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/ValueExpression.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/Visitable.java
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/WhenClause.java
> Modified:
>
>  openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java
>
> Added:
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Address.java
> URL:
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Address.java?rev=723553&view=auto
>
> ==============================================================================
> ---
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Address.java
> (added)
> +++
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Address.java
> Thu Dec  4 17:37:13 2008
> @@ -0,0 +1,39 @@
> +/*
> + * 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.criteria;
> +
> +import java.util.List;
> +
> +import javax.persistence.Entity;
> +import javax.persistence.OneToMany;
> +
> +/**
> + * Used for testing Criteria API.
> + * The fields are sometimes not declared as there is no validation yet
> during
> + * Query construction.
> + *
> + * @author Pinaki Poddar
> + *
> + */
> +@Entity
> +public class Address {
> +       private String zipCode;
> +       @OneToMany
> +       private List<Phone> phones;
> +}
>
> Added:
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Contact.java
> URL:
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Contact.java?rev=723553&view=auto
>
> ==============================================================================
> ---
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Contact.java
> (added)
> +++
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Contact.java
> Thu Dec  4 17:37:13 2008
> @@ -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.criteria;
> +
> +import javax.persistence.OneToOne;
> +
> +public class Contact {
> +       @OneToOne
> +       private Address address;
> +}
>
> Added:
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Contractor.java
> URL:
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Contractor.java?rev=723553&view=auto
>
> ==============================================================================
> ---
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Contractor.java
> (added)
> +++
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Contractor.java
> Thu Dec  4 17:37:13 2008
> @@ -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.criteria;
> +
> +import javax.persistence.Entity;
> +
> +@Entity
> +public class Contractor {
> +
> +}
>
> Added:
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Course.java
> URL:
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Course.java?rev=723553&view=auto
>
> ==============================================================================
> ---
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Course.java
> (added)
> +++
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Course.java
> Thu Dec  4 17:37:13 2008
> @@ -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.criteria;
> +
> +import javax.persistence.Entity;
> +
> +@Entity
> +public class Course {
> +
> +}
>
> Added:
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/CreditCard.java
> URL:
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/CreditCard.java?rev=723553&view=auto
>
> ==============================================================================
> ---
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/CreditCard.java
> (added)
> +++
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/CreditCard.java
> Thu Dec  4 17:37:13 2008
> @@ -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.criteria;
> +
> +import javax.persistence.Entity;
> +
> +@Entity
> +public class CreditCard {
> +
> +}
>
> Added:
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Customer.java
> URL:
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Customer.java?rev=723553&view=auto
>
> ==============================================================================
> ---
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Customer.java
> (added)
> +++
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Customer.java
> Thu Dec  4 17:37:13 2008
> @@ -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.criteria;
> +
> +import javax.persistence.Entity;
> +
> +@Entity
> +public class Customer {
> +       private String firstName;
> +       private String lastName;
> +}
>
> Added:
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Department.java
> URL:
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Department.java?rev=723553&view=auto
>
> ==============================================================================
> ---
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Department.java
> (added)
> +++
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Department.java
> Thu Dec  4 17:37:13 2008
> @@ -0,0 +1,32 @@
> +/*
> + * 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.criteria;
> +
> +import java.util.Set;
> +
> +import javax.persistence.Entity;
> +import javax.persistence.OneToMany;
> +
> +@Entity
> +public class Department {
> +       private int deptNo;
> +       private String name;
> +       @OneToMany
> +       private Set<Employee> employees;
> +}
>
> Added:
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Employee.java
> URL:
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Employee.java?rev=723553&view=auto
>
> ==============================================================================
> ---
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Employee.java
> (added)
> +++
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Employee.java
> Thu Dec  4 17:37:13 2008
> @@ -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.criteria;
> +
> +import javax.persistence.Entity;
> +
> +@Entity
> +public class Employee {
> +       private Address contactInfo;
> +}
>
> Added:
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Exempt.java
> URL:
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Exempt.java?rev=723553&view=auto
>
> ==============================================================================
> ---
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Exempt.java
> (added)
> +++
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Exempt.java
> Thu Dec  4 17:37:13 2008
> @@ -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.criteria;
> +
> +import javax.persistence.Entity;
> +
> +@Entity
> +public class Exempt {
> +
> +}
>
> Added:
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Item.java
> URL:
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Item.java?rev=723553&view=auto
>
> ==============================================================================
> ---
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Item.java
> (added)
> +++
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Item.java
> Thu Dec  4 17:37:13 2008
> @@ -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.criteria;
> +
> +import javax.persistence.Entity;
> +
> +@Entity
> +public class Item {
> +
> +}
>
> Added:
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Manager.java
> URL:
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Manager.java?rev=723553&view=auto
>
> ==============================================================================
> ---
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Manager.java
> (added)
> +++
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Manager.java
> Thu Dec  4 17:37:13 2008
> @@ -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.criteria;
> +
> +import javax.persistence.Entity;
> +
> +@Entity
> +public class Manager {
> +
> +}
>
> Added:
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Order.java
> URL:
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Order.java?rev=723553&view=auto
>
> ==============================================================================
> ---
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Order.java
> (added)
> +++
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Order.java
> Thu Dec  4 17:37:13 2008
> @@ -0,0 +1,33 @@
> +/*
> + * 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.criteria;
> +
> +import javax.persistence.Entity;
> +import javax.persistence.ManyToOne;
> +import javax.persistence.Table;
> +
> +@Entity
> +@Table(name="C_ORDER")
> +public class Order {
> +       private int quantity;
> +
> +       @ManyToOne
> +       private Customer customer;
> +
> +}
>
> Added:
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Person.java
> URL:
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Person.java?rev=723553&view=auto
>
> ==============================================================================
> ---
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Person.java
> (added)
> +++
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Person.java
> Thu Dec  4 17:37:13 2008
> @@ -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.criteria;
> +
> +import javax.persistence.Entity;
> +
> +@Entity
> +public class Person {
> +
> +}
>
> Added:
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Phone.java
> URL:
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Phone.java?rev=723553&view=auto
>
> ==============================================================================
> ---
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Phone.java
> (added)
> +++
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Phone.java
> Thu Dec  4 17:37:13 2008
> @@ -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.criteria;
> +
> +import javax.persistence.Entity;
> +
> +@Entity
> +public class Phone {
> +       private String vendor;
> +}
>
> Added:
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/StringComparison.java
> URL:
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/StringComparison.java?rev=723553&view=auto
>
> ==============================================================================
> ---
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/StringComparison.java
> (added)
> +++
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/StringComparison.java
> Thu Dec  4 17:37:13 2008
> @@ -0,0 +1,121 @@
> +/*
> + * 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.criteria;
> +
> +import java.io.IOException;
> +import java.io.StreamTokenizer;
> +import java.io.StringReader;
> +import java.util.ArrayList;
> +import java.util.Arrays;
> +import java.util.List;
> +
> +/**
> + * Compares a pair of String ignoring case-sensitivity of set of reserved
> words.
> + *
> + * @author Pinaki Poddar
> + *
> + */
> +public class StringComparison {
> +       private static List<String> _reserved = Arrays.asList(new String[]
> {
> +                       "ALL", "AND", "ANY", "AS", "ASC", "AVG",
> +                       "BETWEEN", "BIT_LENGTH", "BY",
> +                       "CASE", "CHAR_LENGTH", "CHARACTER_LENGTH", "CLASS",
> "COALESCE",
> +                       "COUNT","CURRENT_DATE", "CURRENT_TIME",
> "CURRENT_TIMESTAMP",
> +                       "DELETE", "DESC", "DISTINCT",
> +                       "EMPTY", "ENTRY", "EXISTS",
> +                       "FALSE", "FETCH", "FROM",
> +                       "GROUP",
> +                       "HAVING",
> +                       "IN", "INDEX", "INNER", "IS",
> +                       "JOIN",
> +                       "KEY",
> +                       "LEFT", "LIKE", "LOWER",
> +                       "MAX", "MEMBER", "MIN", "MOD",
> +                       "NEW", "NOT", "NULL", "NULLIF",
> +                       "OBJECT", "OF", "OR", "ORDER", "OUTER",
> +                       "POSITION",
> +                       "SELECT", "SOME", "SUM",
> +                       "THEN", "TRIM", "TRUE", "TYPE",
> +                       "UNKNOWN", "UPDATE", "UPPER",
> +                       "VALUE",
> +                       "WHEN", "WHERE",
> +       });
> +
> +       private boolean isReservedWord(String s) {
> +               return _reserved.contains(s.toUpperCase());
> +       }
> +
> +       public List<String> tokenize(String s) throws IOException {
> +               List<String> list = new ArrayList<String>();
> +               StreamTokenizer tok = new StreamTokenizer(new
> StringReader(s));
> +               tok.resetSyntax();
> +               tok.wordChars('a', 'z');
> +               tok.wordChars('0', '9');
> +               tok.wordChars('A', 'Z');
> +               tok.wordChars('\'', '\'');
> +               tok.wordChars('=', '=');
> +               tok.wordChars('>', '>');
> +               tok.wordChars('<', '<');
> +               tok.wordChars('!', '!');
> +               tok.wordChars('.', '.');
> +               for (int ttype; (ttype = tok.nextToken()) !=
> StreamTokenizer.TT_EOF;) {
> +                       if (ttype == StreamTokenizer.TT_WORD)
> +                               list.add(tok.sval);
> +               }
> +               return list;
> +       }
> +
> +       public boolean compare(String s1, String s2) {
> +               try {
> +                       List<String> list1 = tokenize(s1);
> +                       List<String> list2 = tokenize(s2);
> +                       if (list1.size() != list2.size()) {
> +                               System.err.println("Unequal tokens " +
> list1.size() + "!=" +  list2.size());
> +                               return false;
> +                       }
> +                       for (int i = 0; i < list1.size(); i++) {
> +                               String a = list1.get(i);
> +                               String b = list2.get(i);
> +                               boolean match = isReservedWord(a) ?
> a.equalsIgnoreCase(b) : a.equals(b);
> +                               if (!match) {
> +                                       System.err.println("[" + a + "]
> does not match [" + b + "]");
> +                                       return false;
> +                               }
> +                       }
> +                       return true;
> +               } catch (IOException e) {
> +                       e.printStackTrace();
> +               }
> +               return false;
> +       }
> +
> +       public static void main(String[] args) throws Exception {
> +               StringComparison c = new StringComparison();
> +               String s1 = "SELECT DISTINCT o FROM Order AS o JOIN
> o.lineItems AS l WHERE l.shipped != FALSE and l.name like 'hello'";
> +               String s2 = "select DISTINCT o FROM Order AS o  JOIN
> o.lineItems AS  l WHERE l.shipped !=  FALSE and l.name like 'hello'";
> +               boolean match = c.compare(s1, s2);
> +               if (!match) {
> +                       System.err.println(s1);
> +                       System.err.println(c.tokenize(s1));
> +                       System.err.println(s2);
> +                       System.err.println(c.tokenize(s2));
> +               }
> +       }
> +
> +}
>
> Added:
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/TestCriteria.java
> URL:
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/TestCriteria.java?rev=723553&view=auto
>
> ==============================================================================
> ---
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/TestCriteria.java
> (added)
> +++
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/TestCriteria.java
> Thu Dec  4 17:37:13 2008
> @@ -0,0 +1,413 @@
> +/*
> + * 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.criteria;
> +
> +import javax.persistence.DomainObject;
> +import javax.persistence.QueryBuilder;
> +import javax.persistence.QueryDefinition;
> +import javax.persistence.SelectItem;
> +
> +import org.apache.openjpa.persistence.query.AbstractDomainObject;
> +import org.apache.openjpa.persistence.query.QueryDefinitionImpl;
> +import org.apache.openjpa.persistence.test.SingleEMFTestCase;
> +
> +
> +/**
> + * Tests by stringifying QueryDefinition and comparing the resultant
> string
> + * with an equivalent JPQL.
> + *
> + * Does not execute the query.
> + *
> + * The examples are taken from Criteria API Section of Java Persistence
> API
> + * Version 2.0 [1].
> + *
> + * [1] <A href="
> http://jcp.org/aboutJava/communityprocess/pr/jsr317/index.html">
> + * JPA API Specification Version 2.0</A>
> + *
> + * @author Pinaki Poddar
> + *
> + */
> +public class TestCriteria extends SingleEMFTestCase {
> +       protected QueryBuilder qb;
> +       protected StringComparison comparator = new StringComparison();
> +
> +       public void setUp() {
> +               super.setUp(Contractor.class, Course.class,
> CreditCard.class,
> +                       Department.class, Employee.class, Exempt.class,
> Item.class,
> +                       Manager.class, Person.class, VideoStore.class,
> Order.class,
> +                       Customer.class);
> +               qb = emf.getQueryBuilder();
> +       }
> +
> +       public void tearDown() {
> +               // do nothing as you do not have a database connection
> +       }
> +
> +       void compare(String s, QueryDefinition q) {
> +               String actual = ((QueryDefinitionImpl)q).toJPQL();
> +               if (!comparator.compare(s,actual)) {
> +                       fail("\r\nExpected: [" + s + "]\r\nActual  : [" +
> actual + "]");
> +               }
> +       }
> +
> +       void compare(String s, DomainObject q) {
> +               String actual =
> ((AbstractDomainObject)q).getOwner().toJPQL();
> +               if (!comparator.compare(s,actual)) {
> +                       fail("\r\nExpected: [" + s + "]\r\nActual  : [" +
> actual + "]");
> +               }
> +       }
> +
> +       public void testMultipleDomainOfSameClass() {
> +               DomainObject o1 = qb.createQueryDefinition(Order.class);
> +               DomainObject o2 = o1.addRoot(Order.class);
> +               o1.select(o1)
> +                 .where(o1.get("quantity").greaterThan(o2.get("quantity"))
> +                   .and(o2.get("customer").get("lastName").equal("Smith"))
> +
> .and(o2.get("customer").get("firstName").equal("John")));
> +
> +               String jpql = "select o from Order o, Order o2" +
> +                             " where o.quantity > o2.quantity" +
> +                             " and o2.customer.lastName = 'Smith'" +
> +                             " and o2.customer.firstName = 'John'";
> +               compare(jpql, o1);
> +       }
> +
> +       public void testFetchJoin() {
> +               DomainObject d =
> qb.createQueryDefinition(Department.class);
> +               d.leftJoinFetch("employees");
> +               d.where(d.get("deptNo").equal(1));
> +
> +
> +               String jpql = "select d from Department d" +
> +                             " LEFT JOIN FETCH d.employees" +
> +                             " where d.deptNo = 1";
> +               compare(jpql, d);
> +       }
> +
> +       public void testMultipartNavigation() {
> +               DomainObject e = qb.createQueryDefinition(Employee.class);
> +               DomainObject p = e.join("contactInfo").join("phones");
> +               e.where(e.get("contactInfo").get("address").get("zipCode")
> +                               .equal("95094")).select(p.get("vendor"));
> +
> +
> +               String jpql = "select p.vendor from Employee e" +
> +                             " JOIN e.contactInfo c JOIN c.phones p" +
> +                             " where e.contactInfo.address.zipCode =
> '95094'";
> +               compare(jpql, e);
> +       }
> +
> +       public void testOperatorPath() {
> +               QueryDefinition qdef = qb.createQueryDefinition();
> +               DomainObject item = qdef.addRoot(Item.class);
> +               DomainObject photo = item.join("photos");
> +               qdef.select(item.get("name"), photo.value())
> +                   .where(photo.key().like("egret"));
> +
> +
> +               String jpql = "select i.name, VALUE(p) from Item i join
> i.photos p where KEY(p) like 'egret'";
> +               compare(jpql, qdef);
> +       }
> +
> +       public void testLiteral() {
> +               DomainObject c = qb.createQueryDefinition(Customer.class);
> +               DomainObject o = c.join("orders");
> +               DomainObject a = c.join("address");
> +
> o.where(a.get("state").equal("CA").and(a.get("county").equal("Santa
> Clara")));
> +               o.select(o.get("quantity"), o.get("cost").times(1.08),
> a.get("zipCode"));
> +
> +               String jpql = "select o.quantity, o.cost*1.08, a.zipCode" +
> +                             " from Customer c join c.orders o join
> c.address a" +
> +                             " where a.state = 'CA' and a.county = 'Santa
> Clara'";
> +               compare(jpql, c);
> +       }
> +
> +       public void testTypeExpression() {
> +               DomainObject e = qb.createQueryDefinition(Employee.class);
> +               e.select(e.type())
> +                .where(e.type().equal(Exempt.class).not());
> +
> +               String jpql = "select TYPE(e)" +
> +                             " from Employee e" +
> +                             " where TYPE(e) <> Exempt";
> +               compare(jpql, e);
> +       }
> +
> +       public void testIndex() {
> +               DomainObject c = qb.createQueryDefinition(Course.class);
> +               DomainObject w = c.join("studentWaitList");
> +
> c.where(c.get("name").equal("Calculus").and(w.index().equal(0)))
> +                .select(w.get("name"));
> +
> +               String jpql = "select s.name" +
> +                             " from Course c join c.studentWaitList s" +
> +                             " where c.name = 'Calculus' and INDEX(s) =
> 0";
> +               compare(jpql, c);
> +       }
> +
> +       public void testSum() {
> +               DomainObject o = qb.createQueryDefinition(Order.class);
> +               DomainObject l = o.join("lineItems");
> +               DomainObject c = o.join("customer");
> +
> c.where(c.get("lastName").equal("Smith").and(c.get("firstName").equal("John")))
> +                .select(l.get("price").sum());
> +
> +               String jpql = "select SUM(l.price)" +
> +                             " from Order o join o.lineItems l JOIN
> o.customer c" +
> +                             " where c.lastName = 'Smith' and c.firstName
> = 'John'";
> +               compare(jpql, c);
> +       }
> +
> +       public void testSize() {
> +               DomainObject d =
> qb.createQueryDefinition(Department.class);
> +               d.where(d.get("name").equal("Sales"))
> +                .select(d.get("employees").size());
> +
> +               String jpql = "select SIZE(d.employees)" +
> +                             " from Department d " +
> +                             " where d.name = 'Sales'";
> +               compare(jpql, d);
> +       }
> +
> +       public void testGeneralCase() {
> +               DomainObject e = qb.createQueryDefinition(Employee.class);
> +
> e.where(e.get("department").get("name").equal("Engineering"));
> +               e.select(e.get("name"),
> +               e.generalCase()
> +               .when(e.get("rating").equal(1))
> +               .then(e.get("salary").times(1.1))
> +               .when(e.get("rating").equal(2))
> +               .then(e.get("salary").times(1.2))
> +               .elseCase(e.get("salary").times(1.01)));
> +
> +               String jpql = "SELECT e.name,"
> +                                       + " CASE WHEN e.rating = 1 THEN
> e.salary * 1.1"
> +                                       + " WHEN e.rating = 2 THEN e.salary
> * 1.2"
> +                                       + " ELSE e.salary * 1.01"
> +                                       + " END"
> +                                       + " FROM Employee e"
> +                                       + " WHERE e.department.name =
> 'Engineering'";
> +
> +               compare(jpql, e);
> +       }
> +
> +       public void testMemberOf() {
> +               DomainObject p = qb.createQueryDefinition(Person.class);
> +               p.where(p.literal("Joe").member(p.get("nicknames")));
> +
> +               String jpql = "select p from Person p " +
> +                             " where 'Joe' MEMBER OF p.nicknames";
> +               compare(jpql, p);
> +       }
> +
> +       public void testParamater() {
> +               QueryDefinition qdef = qb.createQueryDefinition();
> +               DomainObject customer = qdef.addRoot(Customer.class);
> +
> qdef.where(customer.get("status").equal(qdef.param("status")));
> +
> +               String jpql = "select c from Customer c " +
> +                             " where c.status = :status";
> +               compare(jpql, qdef);
> +       }
> +
> +       public void testBetween() {
> +               DomainObject c =
> qb.createQueryDefinition(CreditCard.class);
> +               DomainObject t = c.join("transactionHistory");
> +               c.select(t).where(c.get("holder").get("name").equal("John
> Doe")
> +                               .and(t.index().between(0, 9)));
> +
> +
> +               String jpql = "select t from CreditCard c JOIN
> c.transactionHistory t" +
> +                             " where c.holder.name = 'John Doe' AND
> INDEX(t) " +
> +                             " BETWEEN 0 AND 9";
> +               compare(jpql, c);
> +       }
> +
> +       public void testIsEmpty() {
> +               DomainObject o = qb.createQueryDefinition(Order.class);
> +               o.where(o.get("lineItems").isEmpty());
> +
> +
> +               String jpql = "select o from Order o " +
> +                             " where o.lineItems IS EMPTY";
> +               compare(jpql, o);
> +       }
> +
> +       public void testNonCorrelatedSubQuery() {
> +               QueryDefinition q1 = qb.createQueryDefinition();
> +               DomainObject goodCustomer = q1.addRoot(Customer.class);
> +
> +               QueryDefinition q2 = qb.createQueryDefinition();
> +               DomainObject customer = q2.addRoot(Customer.class);
> +
> +               q1.where(goodCustomer.get("balanceOwned")
> +
> .lessThan(q2.select(customer.get("balanceOwned").avg())));
> +
> +               String jpql = "select c from Customer c "
> +                                       + " where c.balanceOwned < "
> +                                       + "(select AVG(c2.balanceOwned)
> from Customer c2)";
> +               compare(jpql, q1);
> +       }
> +
> +       public void testNew() {
> +               QueryDefinition q = qb.createQueryDefinition();
> +               DomainObject customer = q.addRoot(Customer.class);
> +               DomainObject order = customer.join("orders");
> +               q.where(order.get("count").greaterThan(100))
> +               .select(q.newInstance(Customer.class,
> +               customer.get("id"),
> +               customer.get("status"),
> +               order.get("count")));
> +
> +
> +               String jpql = "SELECT NEW
> org.apache.openjpa.persistence.criteria.Customer(c.id, c.status, o.count)"
> +                                       + " FROM Customer c JOIN c.orders
> o"
> +                                       + " WHERE o.count > 100";
> +               compare(jpql, q);
> +       }
> +
> +       public void testKeyValueOperatorPath() {
> +       QueryDefinition q = qb.createQueryDefinition();
> +       DomainObject v = q.addRoot(VideoStore.class);
> +       DomainObject i = v.join("videoInventory");
> +       q.where(v.get("location").get("zipcode").equal("94301")
> +       .and(i.value().greaterThan(0)));
> +       q.select(v.get("location").get("street"),
> +       i.key().get("title"),
> +       i.value());
> +
> +       String jpql = "SELECT v.location.street, KEY(v2).title, VALUE(v2)"
> +                               + " FROM VideoStore v JOIN v.videoInventory
> v2"
> +                               + " WHERE v.location.zipcode = '94301' AND
> VALUE(v2) > 0";
> +       compare(jpql, q);
> +       }
> +
> +       public void testGroupByHaving() {
> +               QueryDefinition q = qb.createQueryDefinition();
> +               DomainObject customer = q.addRoot(Customer.class);
> +               q.select(customer.get("status"),
> +               customer.get("filledOrderCount").avg(),
> +               customer.count())
> +               .groupBy(customer.get("status"))
> +               .having(customer.get("status").in(1, 2));
> +
> +               String jpql = "SELECT c.status, AVG(c.filledOrderCount),
> COUNT(c)"
> +                                       + " FROM Customer c"
> +                                       + " GROUP BY c.status"
> +                                       + " HAVING c.status IN (1, 2)";
> +
> +               compare(jpql, q);
> +       }
> +
> +       public void testGroupByHaving2() {
> +               QueryDefinition q = qb.createQueryDefinition();
> +               DomainObject customer = q.addRoot(Customer.class);
> +               q.select(customer.get("country"),
> +               customer.count())
> +               .groupBy(customer.get("country"))
> +               .having(customer.count().greaterThan(30));
> +
> +               String jpql = "SELECT c.country, COUNT(c)"
> +                                       + " FROM Customer c"
> +                                       + " GROUP BY c.country"
> +                                       + " HAVING COUNT(c) > 30";
> +               compare(jpql, q);
> +       }
> +
> +       public void testOrderBy() {
> +               QueryDefinition q = qb.createQueryDefinition();
> +               DomainObject customer = q.addRoot(Customer.class);
> +               DomainObject order = customer.join("orders");
> +               DomainObject address = customer.join("address");
> +               q.where(address.get("state").equal("CA"))
> +               .select(order)
> +               .orderBy(order.get("quantity").desc(),
> order.get("totalcost"));
> +               String jpql = "SELECT o"
> +                                       + " FROM Customer c JOIN c.orders o
> JOIN c.address a"
> +                                       + " WHERE a.state = 'CA'"
> +                                       + " ORDER BY o.quantity DESC,
> o.totalcost";
> +               compare(jpql, q);
> +       }
> +
> +       public void testOrderBy2() {
> +       QueryDefinition q = qb.createQueryDefinition();
> +       DomainObject customer = q.addRoot(Customer.class);
> +       DomainObject order = customer.join("orders");
> +       DomainObject address = customer.join("address");
> +       q.where(address.get("state").equal("CA"))
> +       .select(order.get("quantity"), address.get("zipcode"))
> +       .orderBy(order.get("quantity"), address.get("zipcode"));
> +       String jpql = "SELECT o.quantity, a.zipcode"
> +                               + " FROM Customer c JOIN c.orders o JOIN
> c.address a"
> +                               + " WHERE a.state = 'CA'"
> +                               + " ORDER BY o.quantity, a.zipcode";
> +       compare(jpql, q);
> +       }
> +
> +       public void testOrderByExpression() {
> +       DomainObject o = qb.createQueryDefinition(Order.class);
> +       DomainObject a = o.join("customer").join("address");
> +       SelectItem taxedCost = o.get("cost").times(1.08);
> +       o.select(o.get("quantity"), taxedCost, a.get("zipcode"))
> +       .where(a.get("state").equal("CA")
> +       .and(a.get("county").equal("Santa Clara")))
> +       .orderBy(o.get("quantity"), taxedCost, a.get("zipcode"));
> +
> +       String jpql = "SELECT o.quantity, o.cost*1.08, a.zipcode"
> +                               + " FROM Order o JOIN o.customer c JOIN
> c.address a"
> +                               + " WHERE a.state = 'CA' AND a.county =
> 'Santa Clara'"
> +                               + " ORDER BY o.quantity, o.cost*1.08,
> a.zipcode";
> +
> +       compare(jpql, o);
> +       }
> +
> +       public void testCorrelatedSubquery() {
> +               QueryDefinition q1 = qb.createQueryDefinition();
> +               DomainObject emp = q1.addRoot(Employee.class);
> +
> +               QueryDefinition q2 = qb.createQueryDefinition();
> +               DomainObject spouseEmp = q2.addRoot(Employee.class);
> +
> +
> q2.where(spouseEmp.equal(emp.get("spouse"))).select(spouseEmp);
> +               q1.selectDistinct(emp).where(q2.exists());
> +
> +               String jpql = "SELECT DISTINCT e "
> +                                       + " FROM Employee e"
> +                                       + " WHERE EXISTS ("
> +                                               + " SELECT e2 "
> +                                               + " FROM Employee e2"
> +                                               + " WHERE e2 = e.spouse)";
> +
> +               compare(jpql, q1);
> +       }
> +
> +       public void testCreateSubquery() {
> +               DomainObject customer =
> qb.createQueryDefinition(Customer.class);
> +               DomainObject order =
> qb.createSubqueryDefinition(customer.get("orders"));
> +
> customer.where(order.select(order.get("price").avg()).greaterThan(100));
> +
> +               String jpql = "SELECT c "
> +                                       + " FROM Customer c"
> +                                       + " WHERE (SELECT AVG(o.price) FROM
> c.orders o) > 100";
> +
> +               compare(jpql, customer);
> +       }
> +
> +}
>
> Added:
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/VideoStore.java
> URL:
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/VideoStore.java?rev=723553&view=auto
>
> ==============================================================================
> ---
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/VideoStore.java
> (added)
> +++
> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/VideoStore.java
> Thu Dec  4 17:37:13 2008
> @@ -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.criteria;
> +
> +import javax.persistence.Entity;
> +
> +@Entity
> +public class VideoStore {
> +
> +}
>
> Modified:
> openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java
> URL:
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java?rev=723553&r1=723552&r2=723553&view=diff
>
> ==============================================================================
> ---
> openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java
> (original)
> +++
> openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java
> Thu Dec  4 17:37:13 2008
> @@ -46,6 +46,7 @@
>  import org.apache.openjpa.lib.conf.Value;
>  import org.apache.openjpa.lib.util.Localizer;
>  import org.apache.openjpa.lib.util.Closeable;
> +import org.apache.openjpa.persistence.query.QueryBuilderImpl;
>  import org.apache.openjpa.util.OpenJPAException;
>  import serp.util.Strings;
>
> @@ -342,8 +343,7 @@
>     }
>
>     public QueryBuilder getQueryBuilder() {
> -        throw new UnsupportedOperationException(
> -           "JPA 2.0 - Method not yet implemented");
> +       return new QueryBuilderImpl();
>     }
>
>     public Set<String> getSupportedProperties() {
>
> Added:
> openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AbsExpression.java
> URL:
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AbsExpression.java?rev=723553&view=auto
>
> ==============================================================================
> ---
> openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AbsExpression.java
> (added)
> +++
> openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AbsExpression.java
> Thu Dec  4 17:37:13 2008
> @@ -0,0 +1,31 @@
> +/*
> + * 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;
> +
> +/**
> + * Denotes ABS() operation on a given expression.
> + *
> + * @author Pinaki Poddar
> + *
> + */
> +public class AbsExpression extends UnaryOperatorExpression {
> +       public AbsExpression(ExpressionImpl op) {
> +               super(op, UnaryFunctionalOperator.ABS);
> +       }
> +}
>
> Added:
> openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AbstractDomainObject.java
> URL:
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AbstractDomainObject.java?rev=723553&view=auto
>
> ==============================================================================
> ---
> openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AbstractDomainObject.java
> (added)
> +++
> openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AbstractDomainObject.java
> Thu Dec  4 17:37:13 2008
> @@ -0,0 +1,395 @@
> +/*
> + * 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.ArrayList;
> +import java.util.Calendar;
> +import java.util.Date;
> +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 acts as a proxy for a QueryDefinition via delegation.
> + *
> + * @author Pinaki Poddar
> + *
> + */
> +public abstract class AbstractDomainObject extends AbstractPath
> +       implements DomainObject {
> +       private final QueryDefinitionImpl _owner;
> +       private List<JoinPath> _joins;
> +       private List<FetchPath> _fetchJoins;
> +
> +       protected AbstractDomainObject(QueryDefinitionImpl owner,
> +               AbstractPath parent, PathOperator op, Object part2) {
> +               super(parent, op, part2);
> +               _owner = owner;
> +       }
> +
> +       /**
> +        * Gets the QueryDefinition that created this path.
> +        * @return
> +        */
> +       public QueryDefinitionImpl getOwner() {
> +               return _owner;
> +       }
> +
> +       /**
> +        * Gets the fetch joins associated with this path. Can be null.
> +        */
> +       public List<FetchPath> getFetchJoins() {
> +               return _fetchJoins;
> +       }
> +
> +       /**
> +        * Gets the joins associated with this path. Can be null.
> +        */
> +       public List<JoinPath> getJoins() {
> +               return _joins;
> +       }
> +
> +       /**
> +        * Adding a root adds a root domain to the owning query.
> +        */
> +       public DomainObject addRoot(Class cls) {
> +               return _owner.addRoot(cls);
> +       }
> +
> +       /**
> +        * Adding a query root adds a subquery to the owning query.
> +        */
> +       public DomainObject addSubqueryRoot(PathExpression path) {
> +               return _owner.addSubqueryRoot(path);
> +       }
> +
> +       /**
> +        * Derives a path from this path by navigating through the given
> field.
> +        */
> +       public PathExpression get(String attr) {
> +               return new NavigationPath(_owner, this, attr);
> +       }
> +
> +       /**
> +        * Derives a path from this path by joining the given field.
> +        * Also the joined path becomes a domain of the owning query.
> +        */
> +       public DomainObject join(String attribute) {
> +               return join(attribute, PathOperator.INNER);
> +       }
> +
> +       /**
> +        * Derives a path from this path by outer joining the given field.
> +        * Also the joined path becomes a domain of the owning query.
> +        */
> +       public DomainObject leftJoin(String attribute) {
> +               return join(attribute, PathOperator.OUTER);
> +       }
> +
> +       protected DomainObject join(String attr, PathOperator joinType) {
> +               JoinPath join = new JoinPath(this, joinType, attr);
> +               if (_joins == null) {
> +                       _joins = new ArrayList<JoinPath>();
> +               }
> +               _joins.add(join);
> +               return join;
> +       }
> +
> +       /**
> +        * Derives a path from this path by fetch joining the given field.
> +        */
> +       public FetchJoinObject joinFetch(String attribute) {
> +               return fetchJoin(attribute, PathOperator.FETCH_INNER);
> +       }
> +
> +       /**
> +        * Derives a path from this path by fetch joining the given field.
> +        */
> +       public FetchJoinObject leftJoinFetch(String attribute) {
> +               return fetchJoin(attribute, PathOperator.FETCH_OUTER);
> +       }
> +
> +       private FetchJoinObject fetchJoin(String attr, PathOperator
> joinType) {
> +               NavigationPath path = new NavigationPath(_owner, this,
> attr);
> +               FetchPath join = new FetchPath(path, joinType);
> +               if (_fetchJoins == null) {
> +                       _fetchJoins = new ArrayList<FetchPath>();
> +               }
> +               _fetchJoins.add(join);
> +               return join;
> +       }
> +
> +       /**
> +        * Derives by KEY() operation on this path.
> +        */
> +       public PathExpression key() {
> +               return new KeyExpression(this);
> +       }
> +
> +       /**
> +        * Derives by ENTRY() operation on this path.
> +        */
> +       public SelectItem entry() {
> +               return new EntryExpression(this);
> +       }
> +
> +       /**
> +        * Derives by INDEX() operation on this path.
> +        */
> +       public Expression index() {
> +               return new IndexExpression(this);
> +       }
> +
> +       /**
> +        * Derives a path by VALUE() operation on this path.
> +        */
> +       public PathExpression value() {
> +               return new ValueExpression(this);
> +       }
> +
> +       /**
> +        * Derives this path as ALL(subquery) to its owning query.
> +        */
> +       public Subquery all() {
> +               return _owner.all();
> +       }
> +
> +       /**
> +        * Adds this path as ANY(subquery) to its owning query.
> +        */
> +       public Subquery any() {
> +               return _owner.any();
> +       }
> +
> +       /**
> +        * Adds this path as SOME(subquery) to its owning query.
> +        */
> +       public Subquery some() {
> +               return _owner.some();
> +       }
> +
> +       /**
> +        * Adds this path as EXISTS(subquery) to its owning query.
> +       */
> +       public Predicate exists() {
> +               return _owner.exists();
> +       }
> +
> +       public Expression coalesce(Expression... exp) {
> +               throw new UnsupportedOperationException();
> +       }
> +
> +       public Expression coalesce(String... exp) {
> +               throw new UnsupportedOperationException();
> +       }
> +
> +       public Expression coalesce(Date... exp) {
> +               throw new UnsupportedOperationException();
> +       }
> +
> +       public Expression coalesce(Calendar... exp) {
> +               throw new UnsupportedOperationException();
> +       }
> +
> +       public Expression currentDate() {
> +               return _owner.currentDate();
> +       }
> +
> +       public Expression currentTime() {
> +               return _owner.currentTime();
> +       }
> +
> +       public Expression currentTimestamp() {
> +               return _owner.currentTimestamp();
> +       }
> +
> +       public CaseExpression generalCase() {
> +               return _owner.generalCase();
> +       }
> +
> +       public QueryDefinition groupBy(PathExpression... pathExprs) {
> +               return _owner.groupBy(pathExprs);
> +       }
> +
> +       public QueryDefinition groupBy(List<PathExpression> pathExprList) {
> +               return _owner.groupBy(pathExprList);
> +       }
> +
> +       public QueryDefinition having(Predicate predicate) {
> +               return _owner.having(predicate);
> +       }
> +
> +       public Expression literal(String s) {
> +               return _owner.literal(s);
> +       }
> +
> +       public Expression literal(Number n) {
> +               return _owner.literal(n);
> +       }
> +
> +       public Expression literal(boolean b) {
> +               return _owner.literal(b);
> +       }
> +
> +       public Expression literal(Calendar c) {
> +               return _owner.literal(c);
> +       }
> +
> +       public Expression literal(Date d) {
> +               return _owner.literal(d);
> +       }
> +
> +       public Expression literal(char c) {
> +               return _owner.literal(c);
> +       }
> +
> +       public Expression literal(Class cls) {
> +               return _owner.literal(cls);
> +       }
> +
> +       public Expression literal(Enum<?> e) {
> +               return _owner.literal(e);
> +       }
> +
> +       public SelectItem newInstance(Class cls, SelectItem... args) {
> +               return _owner.newInstance(cls, args);
> +       }
> +
> +       public Expression nullLiteral() {
> +               return _owner.nullLiteral();
> +       }
> +
> +       public Expression nullif(Expression exp1, Expression exp2) {
> +               return _owner.nullif(exp1, exp2);
> +       }
> +
> +       public Expression nullif(Number arg1, Number arg2) {
> +               return _owner.nullif(arg1, arg2);
> +       }
> +
> +       public Expression nullif(String arg1, String arg2) {
> +               return _owner.nullif(arg1, arg2);
> +       }
> +
> +       public Expression nullif(Date arg1, Date arg2) {
> +               return _owner.nullif(arg1, arg2);
> +       }
> +
> +       public Expression nullif(Calendar arg1, Calendar arg2) {
> +               return _owner.nullif(arg1, arg2);
> +       }
> +
> +       public Expression nullif(Class arg1, Class arg2) {
> +               return _owner.nullif(arg1, arg2);
> +       }
> +
> +       public Expression nullif(Enum<?> arg1, Enum<?> arg2) {
> +               return _owner.nullif(arg1, arg2);
> +       }
> +
> +       public QueryDefinition orderBy(OrderByItem... orderByItems) {
> +               return _owner.orderBy(orderByItems);
> +       }
> +
> +       public QueryDefinition orderBy(List<OrderByItem> orderByItemList) {
> +               return _owner.orderBy(orderByItemList);
> +       }
> +
> +       public Expression param(String name) {
> +               return _owner.param(name);
> +       }
> +
> +       public Predicate predicate(boolean b) {
> +               return _owner.predicate(b);
> +       }
> +
> +       public QueryDefinition select(SelectItem... selectItems) {
> +               return _owner.select(selectItems);
> +       }
> +
> +       public QueryDefinition select(List<SelectItem> selectItemList) {
> +               return _owner.select(selectItemList);
> +       }
> +
> +       public QueryDefinition selectDistinct(SelectItem... selectItems) {
> +               return _owner.selectDistinct(selectItems);
> +       }
> +
> +       public QueryDefinition selectDistinct(List<SelectItem>
> selectItemList) {
> +               return _owner.selectDistinct(selectItemList);
> +       }
> +
> +       public CaseExpression simpleCase(Expression caseOperand) {
> +               return _owner.simpleCase(caseOperand);
> +       }
> +
> +       public CaseExpression simpleCase(Number caseOperand) {
> +               return _owner.simpleCase(caseOperand);
> +       }
> +
> +       public CaseExpression simpleCase(String caseOperand) {
> +               return _owner.simpleCase(caseOperand);
> +       }
> +
> +       public CaseExpression simpleCase(Date caseOperand) {
> +               return _owner.simpleCase(caseOperand);
> +       }
> +
> +       public CaseExpression simpleCase(Calendar caseOperand) {
> +               return _owner.simpleCase(caseOperand);
> +       }
> +
> +       public CaseExpression simpleCase(Class caseOperand) {
> +               return _owner.simpleCase(caseOperand);
> +       }
> +
> +       public CaseExpression simpleCase(Enum<?> caseOperand) {
> +               return _owner.simpleCase(caseOperand);
> +       }
> +
> +       public QueryDefinition where(Predicate predicate) {
> +               return _owner.where(predicate);
> +       }
> +
> +       //
> -----------------------------------------------------------------------
> +       // contract for conversion to JPQL.
> +       //
> -----------------------------------------------------------------------
> +       /**
> +        * Sets alias for this domain and all its joins.
> +        */
> +       public void setAlias(AliasContext ctx) {
> +               ctx.getAlias(this);
> +               if (_joins != null)
> +                       for (JoinPath join : _joins)
> +                               join.setAlias(ctx);
> +       }
> +
> +       abstract public String asJoinable(AliasContext ctx);
> +
> +}
>
> Added:
> openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AbstractPath.java
> URL:
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AbstractPath.java?rev=723553&view=auto
>
> ==============================================================================
> ---
> openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AbstractPath.java
> (added)
> +++
> openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AbstractPath.java
> Thu Dec  4 17:37:13 2008
> @@ -0,0 +1,124 @@
> +/*
> + * 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 javax.persistence.Aggregate;
> +import javax.persistence.Expression;
> +import javax.persistence.OrderByItem;
> +import javax.persistence.PathExpression;
> +import javax.persistence.Predicate;
> +
> +/**
> + * 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())
> + * or a join type operation. Based on the exact nature of the second part,
> + * concrete derivation of this class combines the two constituent parts to
> + * arrive at complete path name.
> + * For example, a navigation path adds the two part with a navigation '.'
> + * operator, while a OperatorPath will combine the parts as KEY(parent).
> + *
> + * The constituent parts are immutable and supplied at construction. Hence
> + * concrete implementations know what exact type they are dealing with,
> but
> + * this receiver maintains it state as more generic type to accommodate
> + * concrete types to cast/interpret these state variables.
> + *
> + * @author Pinaki Poddar
> + *
> + */
> +abstract class AbstractPath extends ExpressionImpl implements
> +               PathExpression {
> +       protected final AbstractPath  _parent;
> +       protected final Object            _part2;
> +       protected final PathOperator  _operator;
> +
> +       protected AbstractPath(AbstractPath parent, PathOperator op, Object
> part2) {
> +               _parent = parent;
> +               _part2  = part2;
> +               _operator = op;
> +       }
> +
> +       //
> ------------------------------------------------------------------------
> +       // Path related functions.
> +       //
> ------------------------------------------------------------------------
> +       /**
> +        * Gets the parent from which this receiver has been derived. Can
> be null
> +        * for a root path.
> +        */
> +       public AbstractPath getParent() {
> +               return _parent;
> +       }
> +
> +       /**
> +        * Gets operator that derived this receiver from its parent.
> +        */
> +       public PathOperator getOperator() {
> +               return _operator;
> +       }
> +
> +       /**
> +        * Gets the last segment of this path.
> +        * Concrete implementation should return a covariant type.
> +        */
> +       public Object getLastSegment() {
> +               return _part2;
> +       }
> +
> +       //
> -----------------------------------------------------------------------
> +       // Implementation of PathExpression
> +       //
> -----------------------------------------------------------------------
> +       public Aggregate avg() {
> +               return new AverageExpression(this);
> +       }
> +
> +       public Aggregate count() {
> +               return new CountExpression(this);
> +       }
> +
> +       public Predicate isEmpty() {
> +               return new IsEmptyExpression(this);
> +       }
> +
> +       public Aggregate max() {
> +               return new MaxExpression(this);
> +       }
> +
> +       public Aggregate min() {
> +               return new MinExpression(this);
> +       }
> +
> +       public Expression size() {
> +               return new SizeExpression(this);
> +       }
> +
> +       public Aggregate sum() {
> +               return new SumExpression(this);
> +       }
> +
> +       public Expression type() {
> +               return new TypeExpression(this);
> +       }
> +
> +       public OrderByItem asc() {
> +               return new OrderableItem(this, Boolean.TRUE);
> +       }
> +
> +       public OrderByItem desc() {
> +               return new OrderableItem(this, Boolean.FALSE);
> +       }
> +}
>
> Added:
> openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AliasContext.java
> URL:
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AliasContext.java?rev=723553&view=auto
>
> ==============================================================================
> ---
> openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AliasContext.java
> (added)
> +++
> openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AliasContext.java
> Thu Dec  4 17:37:13 2008
> @@ -0,0 +1,60 @@
> +/*
> + * 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.HashMap;
> +import java.util.Map;
> +
> +import javax.persistence.Expression;
> +
> +class AliasContext {
> +       private Map<ExpressionImpl, String> _aliases =
> +               new HashMap<ExpressionImpl, String>();
> +
> +       /**
> +        * Sets alias for the given Expression or gets the alias if the
> given
> +        * path has already been assigned an alias.
> +        * The given expression must provide a hint on what should be the
> +        * alias name. If the alias name is assigned by this context, then
> a
> +        * different alias is generated.
> +        * @param path
> +        * @return the alias name
> +        */
> +       public String getAlias(ExpressionImpl path) {
> +               String alias = _aliases.get(path);
> +               if (alias != null)
> +                       return alias;
> +               alias = path.getAliasHint().substring(0,1).toLowerCase();
> +               int i = 2;
> +               while (_aliases.containsValue(alias)) {
> +                       alias = alias + i;
> +                       i++;
> +               }
> +               _aliases.put(path, alias);
> +               return alias;
> +       }
> +
> +       /**
> +        * Affirms if the given Expression has been assigned an alias by
> this
> +        * context.
> +        */
> +       public boolean hasAlias(Expression path) {
> +               return _aliases.containsKey(path);
> +       }
> +}
>
> Added:
> openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AllExpression.java
> URL:
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AllExpression.java?rev=723553&view=auto
>
> ==============================================================================
> ---
> openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AllExpression.java
> (added)
> +++
> openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AllExpression.java
> Thu Dec  4 17:37:13 2008
> @@ -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 javax.persistence.DomainObject;
> +import javax.persistence.QueryDefinition;
> +import javax.persistence.Subquery;
> +
> +/**
> + * Denotes All(SubQuery) Expression.
> + *
> + * @author Pinaki Poddar
> + *
> + */
> +class AllExpression extends QueryExpression implements Subquery {
> +       public AllExpression(QueryDefinitionImpl sub) {
> +               super(sub, UnaryFunctionalOperator.ALL);
> +       }
> +}
>
> Added:
> openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AndPredicate.java
> URL:
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AndPredicate.java?rev=723553&view=auto
>
> ==============================================================================
> ---
> openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AndPredicate.java
> (added)
> +++
> openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AndPredicate.java
> Thu Dec  4 17:37:13 2008
> @@ -0,0 +1,34 @@
> +/*
> + * 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 javax.persistence.Predicate;
> +import static org.apache.openjpa.persistence.query.ConditionalOperator.*;
> +
> +/**
> + * Denotes (e1 AND e2) predicate.
> + *
> + * @author Pinaki Poddar
> + *
> + */
> +public class AndPredicate extends LogicalPredicate {
> +       public AndPredicate(Predicate p1, Predicate p2) {
> +               super(p1, AND, OR, p2);
> +       }
> +}
>
> Added:
> openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AnyExpression.java
> URL:
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AnyExpression.java?rev=723553&view=auto
>
> ==============================================================================
> ---
> openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AnyExpression.java
> (added)
> +++
> openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AnyExpression.java
> Thu Dec  4 17:37:13 2008
> @@ -0,0 +1,34 @@
> +/*
> + * 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 javax.persistence.QueryDefinition;
> +import javax.persistence.Subquery;
> +
> +/**
> + * Denotes ANY(SUbquery) Expression.
> + *
> + * @author Pinaki Poddar
> + *
> + */
> +class AnyExpression extends UnaryOperatorExpression implements Subquery {
> +       public AnyExpression(QueryDefinitionImpl sub) {
> +               super(sub, UnaryFunctionalOperator.ANY);
> +       }
> +}
>
> Added:
> openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AverageExpression.java
> URL:
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AverageExpression.java?rev=723553&view=auto
>
> ==============================================================================
> ---
> openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AverageExpression.java
> (added)
> +++
> openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AverageExpression.java
> Thu Dec  4 17:37:13 2008
> @@ -0,0 +1,31 @@
> +/*
> + * 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;
> +
> +/**
> + * Denotes AVG() on a given Expression.
> + *
> + * @author Pinaki Poddar
> + *
> + */
> +public class AverageExpression extends UnaryOperatorExpression {
> +       public AverageExpression(ExpressionImpl op) {
> +               super(op, UnaryFunctionalOperator.AVG);
> +       }
> +}
>
> Added:
> openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/BetweenExpression.java
> URL:
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/BetweenExpression.java?rev=723553&view=auto
>
> ==============================================================================
> ---
> openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/BetweenExpression.java
> (added)
> +++
> openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/BetweenExpression.java
> Thu Dec  4 17:37:13 2008
> @@ -0,0 +1,39 @@
> +/*
> + * 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 javax.persistence.Expression;
> +
> +
> +/**
> + * Denotes e1 BETWEEN(e2 AND e3) Expression.
> + *
> + * @author Pinaki Poddar
> + *
> + */
> +public class BetweenExpression extends BinaryExpressionPredicate {
> +       public BetweenExpression(Expression arg1, RangeExpression arg2) {
> +               super(arg1, BinaryConditionalOperator.BETWEEN,
> +                       BinaryConditionalOperator.BETWEEN_NOT, arg2);
> +       }
> +
> +//     public String toJPQL(AliasContext ctx) {
> +//             return super.toJPQL(ctx) + " AND " +
> ((ExpressionImpl)arg3).toJPQL(ctx);
> +//     }
> +}
>
> Added:
> openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/BinaryConditionalOperator.java
> URL:
> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/BinaryConditionalOperator.java?rev=723553&view=auto
>
> ==============================================================================
> ---
> openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/BinaryConditionalOperator.java
> (added)
> +++
> openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/BinaryConditionalOperator.java
> Thu Dec  4 17:37:13 2008
> @@ -0,0 +1,55 @@
> +/*
> + * 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;
> +
> +/**
> + * Enumeration of conditional operator that operates on ordered pair of
> + * expression to generate a predicate.
> + *
> + * @see BinaryExpressionPredicate
> + *
> + * @author Pinaki Poddar
> + *
> + */
> +public enum BinaryConditionalOperator {
> +       BETWEEN("BETWEEN"),
> +       BETWEEN_NOT("NOT BETWEEN"),
> +       EQUAL("="),
> +       EQUAL_NOT("<>"),
> +       GREATER(">"),
> +       GREATEREQUAL(">="),
> +       IN("IN"),
> +       IN_NOT("NOT IN"),
> +       LESS("<"),
> +       LESSEQUAL("<="),
> +       LIKE("LIKE"),
> +       LIKE_NOT("NOT LIKE"),
> +       MEMBER("MEMBER OF"),
> +       MEMBER_NOT("NOT MEMBER OF");
> +
> +       private final String _symbol;
> +
> +       BinaryConditionalOperator(String symbol) {
> +               _symbol = symbol;
> +       }
> +
> +       public String toString() {
> +               return _symbol;
> +       }
> +}
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message