openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hthom...@apache.org
Subject svn commit: r1469090 - in /openjpa/branches/2.1.x: ./ openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/ openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/
Date Wed, 17 Apr 2013 22:55:03 GMT
Author: hthomann
Date: Wed Apr 17 22:55:02 2013
New Revision: 1469090

URL: http://svn.apache.org/r1469090
Log:
OPENJPA-2305: Canonical MetaModel class generation should not use inhertence - applied Pinaki's
trunk changes to 2.1.x.

Modified:
    openjpa/branches/2.1.x/   (props changed)
    openjpa/branches/2.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/PathImpl.java
    openjpa/branches/2.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/AnnotationProcessor6.java
    openjpa/branches/2.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/SourceAnnotationHandler.java

Propchange: openjpa/branches/2.1.x/
------------------------------------------------------------------------------
  Merged /openjpa/trunk:r1420324,1451369,1456574,1456614

Modified: openjpa/branches/2.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/PathImpl.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/PathImpl.java?rev=1469090&r1=1469089&r2=1469090&view=diff
==============================================================================
--- openjpa/branches/2.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/PathImpl.java
(original)
+++ openjpa/branches/2.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/PathImpl.java
Wed Apr 17 22:55:02 2013
@@ -238,6 +238,9 @@ class PathImpl<Z,X> extends ExpressionIm
      *  Gets a new path that represents the given single-valued attribute from this path.
      */
     public <Y> Path<Y> get(SingularAttribute<? super X, Y> attr) {
+    	if (getType() != attr.getDeclaringType()) {
+    		attr = (SingularAttribute)((ManagedType)getType()).getAttribute(attr.getName());
+    	}
         return new PathImpl<X,Y>(this, (Members.SingularAttributeImpl<? super X,
Y>)attr, attr.getJavaType());
     }
     
@@ -245,6 +248,9 @@ class PathImpl<Z,X> extends ExpressionIm
      *  Gets a new path that represents the given multi-valued attribute from this path.
      */
     public <E, C extends java.util.Collection<E>> Expression<C>  get(PluralAttribute<X,
C, E> coll) {
+    	if (getType() != coll.getDeclaringType()) {
+    		coll = (PluralAttribute)((ManagedType)getType()).getAttribute(coll.getName());
+    	}
         return new PathImpl<X,C>(this, (Members.PluralAttributeImpl<? super X, C,
E>)coll, coll.getJavaType());
     }
 
@@ -252,6 +258,9 @@ class PathImpl<Z,X> extends ExpressionIm
      *  Gets a new path that represents the given map-valued attribute from this path.
      */
     public <K, V, M extends java.util.Map<K, V>> Expression<M> get(MapAttribute<X,
K, V> map) {
+    	if (getType() != map.getDeclaringType()) {
+    		map = (MapAttribute)((ManagedType)getType()).getAttribute(map.getName());
+    	}
         return new PathImpl<X,M>(this, (Members.MapAttributeImpl<? super X,K,V>)map,
(Class<M>)map.getJavaType());
     }
     

Modified: openjpa/branches/2.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/AnnotationProcessor6.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/AnnotationProcessor6.java?rev=1469090&r1=1469089&r2=1469090&view=diff
==============================================================================
--- openjpa/branches/2.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/AnnotationProcessor6.java
(original)
+++ openjpa/branches/2.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/AnnotationProcessor6.java
Wed Apr 17 22:55:02 2013
@@ -99,7 +99,6 @@ import org.apache.openjpa.persistence.ut
                     "openjpa.header",
                     "openjpa.metamodel"
                   })
-@SupportedSourceVersion(RELEASE_6)
 
 public class AnnotationProcessor6 extends AbstractProcessor {
     private SourceAnnotationHandler handler;

Modified: openjpa/branches/2.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/SourceAnnotationHandler.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/SourceAnnotationHandler.java?rev=1469090&r1=1469089&r2=1469090&view=diff
==============================================================================
--- openjpa/branches/2.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/SourceAnnotationHandler.java
(original)
+++ openjpa/branches/2.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/SourceAnnotationHandler.java
Wed Apr 17 22:55:02 2013
@@ -41,6 +41,7 @@ import javax.lang.model.element.TypeElem
 import javax.lang.model.element.VariableElement;
 import javax.lang.model.type.ArrayType;
 import javax.lang.model.type.DeclaredType;
+import javax.lang.model.type.NoType;
 import javax.lang.model.type.PrimitiveType;
 import javax.lang.model.type.TypeKind;
 import javax.lang.model.type.TypeMirror;
@@ -642,11 +643,11 @@ public class SourceAnnotationHandler 
     }
 
     public TypeElement getPersistentSupertype(TypeElement cls) {
+    	if (cls == null) return null;
         TypeMirror sup = cls.getSuperclass();
-        if (sup == null || isRootObject(sup))
+        if (sup == null || sup.getKind() == TypeKind.NONE ||  isRootObject(sup))
             return null;
-        TypeElement supe =
-            (TypeElement) processingEnv.getTypeUtils().asElement(sup);
+        TypeElement supe = (TypeElement) processingEnv.getTypeUtils().asElement(sup);
         if (isAnnotatedAsEntity(supe)) 
             return supe;
         return getPersistentSupertype(supe);



Mime
View raw message