openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ppod...@apache.org
Subject svn commit: r810347 - in /openjpa/trunk: openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/ openjpa-persistence/src/main/java/org/apache/openjpa/persi...
Date Wed, 02 Sep 2009 03:03:48 GMT
Author: ppoddar
Date: Wed Sep  2 03:03:48 2009
New Revision: 810347

URL: http://svn.apache.org/viewvc?rev=810347&view=rev
Log:
OPNJPA-1275: Align with JPA 2.0 Public Draft 2

Modified:
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/TestMetamodel.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestQueryParameters.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/CriteriaBuilder.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/CriteriaQueryImpl.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Expressions.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/SubqueryImpl.java

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/TestMetamodel.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/TestMetamodel.java?rev=810347&r1=810346&r2=810347&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/TestMetamodel.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/TestMetamodel.java
Wed Sep  2 03:03:48 2009
@@ -229,10 +229,10 @@
         assertNotNull(superClass.getCollection("collectionRelation"));
         assertNotNull(superClass.getCollection("collectionRelation", ExplicitFieldAccess.class));
         
-        assertNotNull(subClass.getCollections());
-        assertNotNull(superClass.getCollections());
-        assertEquals(6, subClass.getCollections().size());
-        assertEquals(5, superClass.getCollections().size());
+        assertNotNull(subClass.getPluralAttributes());
+        assertNotNull(superClass.getPluralAttributes());
+        assertEquals(6, subClass.getPluralAttributes().size());
+        assertEquals(5, superClass.getPluralAttributes().size());
         
         assertNotNull(subClass.getDeclaredAttribute("mapRelationKeyEmbedded"));
         
@@ -243,10 +243,10 @@
         
         assertNotNull(superClass.getDeclaredCollection("collectionRelation"));
         
-        assertNotNull(subClass.getDeclaredCollections());
-        assertNotNull(superClass.getDeclaredCollections());
-        assertEquals(1, subClass.getDeclaredCollections().size());
-        assertEquals(5, superClass.getDeclaredCollections().size());
+        assertNotNull(subClass.getDeclaredPluralAttributes());
+        assertNotNull(superClass.getDeclaredPluralAttributes());
+        assertEquals(1, subClass.getDeclaredPluralAttributes().size());
+        assertEquals(5, superClass.getDeclaredPluralAttributes().size());
         
         assertNotNull(superClass.getDeclaredList("listRelation"));
         assertNotNull(superClass.getDeclaredList("listRelation", ExplicitFieldAccess.class));

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestQueryParameters.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestQueryParameters.java?rev=810347&r1=810346&r2=810347&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestQueryParameters.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestQueryParameters.java
Wed Sep  2 03:03:48 2009
@@ -123,11 +123,11 @@
         
         Parameter<?> param1 = q.getParameter(1);
         assertTrue(param1 instanceof ParameterImpl);
-        assertEquals(long.class, param1.getJavaType());
+        assertEquals(long.class, param1.getParameterType());
         
         Parameter<?> param2 = q.getParameter(2);
         assertTrue(param2 instanceof ParameterImpl);
-        assertEquals(String.class, param2.getJavaType());
+        assertEquals(String.class, param2.getParameterType());
     }
     
     public void testNamedParameterValueTypeInJPQLQuery() {
@@ -138,11 +138,11 @@
         
         Parameter<?> param1 = q.getParameter("id");
         assertTrue(param1 instanceof ParameterImpl);
-        assertEquals(long.class, param1.getJavaType());
+        assertEquals(long.class, param1.getParameterType());
         
         Parameter<?> param2 = q.getParameter("name");
         assertTrue(param2 instanceof ParameterImpl);
-        assertEquals(String.class, param2.getJavaType());
+        assertEquals(String.class, param2.getParameterType());
     }
     
     public void testNamedParameterInPreparedQuery() {
@@ -240,11 +240,11 @@
         
         Parameter<?> param1 = q.getParameter(1);
         assertTrue(param1 instanceof ParameterImpl);
-        assertEquals(long.class, param1.getJavaType());
+        assertEquals(long.class, param1.getParameterType());
         
         Parameter<?> param2 = q.getParameter(2);
         assertTrue(param2 instanceof ParameterImpl);
-        assertEquals(String.class, param2.getJavaType());
+        assertEquals(String.class, param2.getParameterType());
     }
     
     public void testNamedParameterValueTypeInNamedQuery() {
@@ -254,11 +254,11 @@
         
         Parameter<?> param1 = q.getParameter("id");
         assertTrue(param1 instanceof ParameterImpl);
-        assertEquals(long.class, param1.getJavaType());
+        assertEquals(long.class, param1.getParameterType());
         
         Parameter<?> param2 = q.getParameter("name");
         assertTrue(param2 instanceof ParameterImpl);
-        assertEquals(String.class, param2.getJavaType());
+        assertEquals(String.class, param2.getParameterType());
     }
     
     public void testCriteriaQueryWithNamedParameter() {

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java?rev=810347&r1=810346&r2=810347&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java
Wed Sep  2 03:03:48 2009
@@ -757,7 +757,7 @@
      */
     public <T> Parameter<T> getParameter(String name, Class<T> type) {
         Parameter<?> param = getParameter(name);
-        if (param.getJavaType().isAssignableFrom(type))
+        if (param.getParameterType().isAssignableFrom(type))
             throw new IllegalArgumentException(param + " does not match the requested type
" + type);
         return (Parameter<T>)param;
     }
@@ -772,7 +772,7 @@
      */
     public <T> Parameter<T> getParameter(int pos, Class<T> type) {
         Parameter<?> param = getParameter(pos);
-        if (param.getJavaType().isAssignableFrom(type))
+        if (param.getParameterType().isAssignableFrom(type))
             throw new IllegalArgumentException(param + " does not match the requested type
" + type);
         return (Parameter<T>)param;
     }
@@ -1028,13 +1028,13 @@
 
     void assertValueAssignable(Parameter<?> param, Object v) {
         if (v == null) {
-            if (param.getJavaType().isPrimitive())
+            if (param.getParameterType().isPrimitive())
                 throw new IllegalArgumentException(_loc.get("param-null-primitive", param).getMessage());
             return;
         }
-        if (!Filters.canConvert(v.getClass(), param.getJavaType(), true)) {
+        if (!Filters.canConvert(v.getClass(), param.getParameterType(), true)) {
             throw new IllegalArgumentException(_loc.get("param-type-mismatch", new Object[]{
-                param, getQueryString(), v, v.getClass().getName(), param.getJavaType().getName()}).getMessage());
+                param, getQueryString(), v, v.getClass().getName(), param.getParameterType().getName()}).getMessage());
         }
     }
     

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/CriteriaBuilder.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/CriteriaBuilder.java?rev=810347&r1=810346&r2=810347&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/CriteriaBuilder.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/CriteriaBuilder.java
Wed Sep  2 03:03:48 2009
@@ -310,7 +310,7 @@
     }
 
     public <E, C extends Collection<E>> Predicate isMember(Expression<E>
e, Expression<C> c) {
-        return new Expressions.IsMember<E>(e.getJavaType(), e, c);
+        return new Expressions.IsMember<E>((Class<E>)e.getJavaType(), e, c);
     }
 
     public <C extends Collection<?>> Predicate isNotEmpty(Expression<C>
collection) {

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/CriteriaQueryImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/CriteriaQueryImpl.java?rev=810347&r1=810346&r2=810347&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/CriteriaQueryImpl.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/CriteriaQueryImpl.java
Wed Sep  2 03:03:48 2009
@@ -237,10 +237,22 @@
 
     public CriteriaQuery<T> groupBy(Expression<?>... grouping) {
     	_groups = new ArrayList<Expression<?>>();
+    	if (grouping == null)
+    	    return this;
     	for (Expression<?> e : grouping)
     		_groups.add(e);
         return this;
     }
+    
+    public CriteriaQuery<T> groupBy(List<Expression<?>> grouping) {
+        _groups = new ArrayList<Expression<?>>();
+        if (grouping == null)
+            return this;
+        for (Expression<?> e : grouping)
+            _groups.add(e);
+        return this;
+    }
+
 
     public CriteriaQuery<T> having(Expression<Boolean> restriction) {
         _having = new PredicateImpl().add(restriction);
@@ -254,8 +266,23 @@
         return this;
     }
 
-    public CriteriaQuery<T> orderBy(Order... o) {
-        _orders = Arrays.asList(o);
+    public CriteriaQuery<T> orderBy(Order... orders) {
+        _orders = new ArrayList<Order>();
+        if (orders == null)
+            return this;
+        for (Order o : orders) {
+            _orders.add(o);
+        }
+        return this;
+    }
+    
+    public CriteriaQuery<T> orderBy(List<Order> orders) {
+        _orders = new ArrayList<Order>();
+        if (orders == null)
+            return this;
+        for (Order o : orders) {
+            _orders.add(o);
+        }
         return this;
     }
     

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Expressions.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Expressions.java?rev=810347&r1=810346&r2=810347&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Expressions.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Expressions.java
Wed Sep  2 03:03:48 2009
@@ -193,7 +193,7 @@
         }
         
         public UnaryFunctionalExpression(Expression<X> e) {
-            this(e.getJavaType(), e);
+            this((Class<X>)e.getJavaType(), e);
         }
         
         public void acceptVisit(CriteriaExpressionVisitor visitor) {
@@ -1263,15 +1263,13 @@
         private Expression<?> val2;
 
         public Nullif(Expression<T> x, Expression<?> y) {
-            super(x.getJavaType());
+            super((Class<T>)x.getJavaType());
             val1 = x;
             val2 = y;
         }
 
         public Nullif(Expression<T> x, T y) {
-            super(x.getJavaType());
-            val1 = x;
-            val2 = new Constant<T>(y);
+            this(x, new Constant<T>(y));
         }
 
         @Override
@@ -1636,7 +1634,7 @@
         final SubqueryImpl<X> e;
         
         public SubqueryExpression(Subquery<X> x) {
-            super(x.getJavaType());
+            super((Class<X>)x.getJavaType());
             e = (SubqueryImpl<X>)x;
         }
         

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/SubqueryImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/SubqueryImpl.java?rev=810347&r1=810346&r2=810347&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/SubqueryImpl.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/SubqueryImpl.java
Wed Sep  2 03:03:48 2009
@@ -156,6 +156,11 @@
         _delegate.groupBy(grouping);
         return this;
     }
+    
+    public Subquery<T> groupBy(List<Expression<?>> grouping) {
+        _delegate.groupBy(grouping);
+        return this;
+    }
 
     public Subquery<T> having(Expression<Boolean> restriction) {
         _delegate.having(restriction);



Mime
View raw message