openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ppod...@apache.org
Subject svn commit: r769549 - in /openjpa/trunk: openjpa-persistence-jdbc/ openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ openjpa-persistence/ openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/ openjpa-persisten...
Date Tue, 28 Apr 2009 21:21:55 GMT
Author: ppoddar
Date: Tue Apr 28 21:21:52 2009
New Revision: 769549

URL: http://svn.apache.org/viewvc?rev=769549&view=rev
Log:
OPENJPA-1008: Test cases for JPA 2.0 metamodel generation and population

Added:
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ArrayMember.java
      - copied, changed from r766946, openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/ArrayMember.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/Embed0.java
      - copied, changed from r766946, openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/Embed0.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/Embed1.java
      - copied, changed from r766946, openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/Embed1.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ExplicitFieldAccess.java
      - copied, changed from r766946, openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/ExplicitFieldAccess.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ExplicitFieldAccessMixed.java
      - copied, changed from r766946, openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/ExplicitFieldAccessMixed.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ExplicitPropertyAccess.java
      - copied, changed from r766946, openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/ExplicitPropertyAccess.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ExplicitPropertyAccessMixed.java
      - copied, changed from r766946, openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/ExplicitPropertyAccessMixed.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ImplicitFieldAccessBase.java
      - copied, changed from r765245, openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/DefaultFieldAccessBase.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ImplicitFieldAccessMappedSuperclass.java
      - copied, changed from r765245, openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/DefaultFieldAccessMappedSuperclass.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ImplicitFieldAccessSubclass.java
      - copied, changed from r765245, openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/DefaultFieldAccessSubclass.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/TestMetamodel.java
  (with props)
Removed:
    openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/ArrayMember.java
    openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/DefaultFieldAccessBase.java
    openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/DefaultFieldAccessMappedSuperclass.java
    openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/DefaultFieldAccessSubclass.java
    openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/Embed0.java
    openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/Embed1.java
    openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/ExplicitFieldAccess.java
    openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/ExplicitFieldAccessMixed.java
    openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/ExplicitPropertyAccess.java
    openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/ExplicitPropertyAccessMixed.java
    openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/TestCanonicalMetamodelGeneration.java
Modified:
    openjpa/trunk/openjpa-persistence-jdbc/pom.xml
    openjpa/trunk/openjpa-persistence/pom.xml
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/MetamodelImpl.java

Modified: openjpa/trunk/openjpa-persistence-jdbc/pom.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/pom.xml?rev=769549&r1=769548&r2=769549&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/pom.xml (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/pom.xml Tue Apr 28 21:21:52 2009
@@ -375,30 +375,6 @@
                 </repository>
             </repositories>
         </profile>
-  		<profile>
-  		<!-- =============================================================== -->
-  		<!-- Compiling with JDK5 compiler excludes classes that explicitly   -->
-  		<!-- import and use JDK6 classes/packages for annotation processing  -->
-  		<!-- =============================================================== -->
-  		    <id>jdk5-compiler</id>
-            <build>
-              <plugins>
-		        <plugin>
-		    		<groupId>org.apache.maven.plugins</groupId>
-		    		<artifactId>maven-compiler-plugin</artifactId>
-		    		
-		            <configuration>
-		    		<testExcludes>
-		    		   <testExclude>**/TestCanonicalMetamodelGeneration.java</testExclude>
-		    		</testExcludes>
-		            </configuration>
-		        </plugin>
-		      </plugins>
-		   </build>
-		   <activation>
-		      <jdk>1.5</jdk>
-		   </activation>
-  		</profile>
           
     </profiles>
 

Copied: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ArrayMember.java
(from r766946, openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/ArrayMember.java)
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ArrayMember.java?p2=openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ArrayMember.java&p1=openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/ArrayMember.java&r1=766946&r2=769549&rev=769549&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/ArrayMember.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ArrayMember.java
Tue Apr 28 21:21:52 2009
@@ -19,12 +19,15 @@
 package org.apache.openjpa.persistence.meta;
 
 import javax.persistence.Basic;
+import javax.persistence.ElementCollection;
 import javax.persistence.Entity;
 
+import org.apache.openjpa.persistence.PersistentCollection;
+
 @Entity
 public class ArrayMember {
 	@Basic
-	private Integer[] Array;
+	private Byte[] Array;
 	@Basic
-	private int[] array;
+	private byte[] array;
 }

Copied: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/Embed0.java
(from r766946, openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/Embed0.java)
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/Embed0.java?p2=openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/Embed0.java&p1=openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/Embed0.java&r1=766946&r2=769549&rev=769549&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/Embed0.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/Embed0.java
Tue Apr 28 21:21:52 2009
@@ -37,7 +37,7 @@
 public class Embed0 {
 	private long f1;
 	@OneToOne
-	private DefaultFieldAccessSubclass entity1;
+	private ImplicitFieldAccessSubclass entity1;
 	
 	public long getF1() {
 		return f1;
@@ -45,10 +45,10 @@
 	public void setF1(long f1) {
 		this.f1 = f1;
 	}
-	public DefaultFieldAccessSubclass getEntity1() {
+	public ImplicitFieldAccessSubclass getEntity1() {
 		return entity1;
 	}
-	public void setEntity1(DefaultFieldAccessSubclass entity1) {
+	public void setEntity1(ImplicitFieldAccessSubclass entity1) {
 		this.entity1 = entity1;
 	}
 }

Copied: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/Embed1.java
(from r766946, openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/Embed1.java)
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/Embed1.java?p2=openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/Embed1.java&p1=openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/Embed1.java&r1=766946&r2=769549&rev=769549&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/Embed1.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/Embed1.java
Tue Apr 28 21:21:52 2009
@@ -36,7 +36,7 @@
 @Access(AccessType.PROPERTY)
 public class Embed1 {
 	private String f1;
-	private DefaultFieldAccessBase entity0;
+	private ImplicitFieldAccessBase entity0;
 	
 	
 	public String getF1() {
@@ -47,11 +47,11 @@
 	}
 	
 	@OneToOne
-	public DefaultFieldAccessBase getEntity0() {
+	public ImplicitFieldAccessBase getEntity0() {
 		return entity0;
 	}
 	
-	public void setEntity0(DefaultFieldAccessBase entity0) {
+	public void setEntity0(ImplicitFieldAccessBase entity0) {
 		this.entity0 = entity0;
 	}
 }

Copied: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ExplicitFieldAccess.java
(from r766946, openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/ExplicitFieldAccess.java)
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ExplicitFieldAccess.java?p2=openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ExplicitFieldAccess.java&p1=openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/ExplicitFieldAccess.java&r1=766946&r2=769549&rev=769549&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/ExplicitFieldAccess.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ExplicitFieldAccess.java
Tue Apr 28 21:21:52 2009
@@ -38,9 +38,9 @@
 	private long f1;
 	private int  f2;
 	@Transient private short f3;
-	private DefaultFieldAccessBase f4;
-	private DefaultFieldAccessBase f5;
-	private transient DefaultFieldAccessBase f6;
+	private ImplicitFieldAccessBase f4;
+	private ImplicitFieldAccessBase f5;
+	private transient ImplicitFieldAccessBase f6;
 	
 	public long getF1() {
 		return f1;
@@ -60,24 +60,24 @@
 	public void setF3(short f3) {
 		this.f3 = f3;
 	}
-	public DefaultFieldAccessBase getF4() {
+	public ImplicitFieldAccessBase getF4() {
 		return f4;
 	}
-	public void setF4(DefaultFieldAccessBase f4) {
+	public void setF4(ImplicitFieldAccessBase f4) {
 		this.f4 = f4;
 	}
 	
-	public DefaultFieldAccessBase getF5() {
+	public ImplicitFieldAccessBase getF5() {
 		return f5;
 	}
-	public void setF5(DefaultFieldAccessBase f5) {
+	public void setF5(ImplicitFieldAccessBase f5) {
 		this.f5 = f5;
 	}
 	
-	public DefaultFieldAccessBase getF6() {
+	public ImplicitFieldAccessBase getF6() {
 		return f6;
 	}
-	public void setF6(DefaultFieldAccessBase f6) {
+	public void setF6(ImplicitFieldAccessBase f6) {
 		this.f6 = f6;
 	}
 }

Copied: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ExplicitFieldAccessMixed.java
(from r766946, openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/ExplicitFieldAccessMixed.java)
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ExplicitFieldAccessMixed.java?p2=openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ExplicitFieldAccessMixed.java&p1=openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/ExplicitFieldAccessMixed.java&r1=766946&r2=769549&rev=769549&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/ExplicitFieldAccessMixed.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ExplicitFieldAccessMixed.java
Tue Apr 28 21:21:52 2009
@@ -39,9 +39,9 @@
 	private long f1;
 	private int  f2;
 	@Transient private short f3;
-	private DefaultFieldAccessBase f4;
-    private DefaultFieldAccessBase f5;
-	private transient DefaultFieldAccessBase f6;
+	private ImplicitFieldAccessBase f4;
+    private ImplicitFieldAccessBase f5;
+	private transient ImplicitFieldAccessBase f6;
 	
 	public long getF1() {
 		return f1;
@@ -61,26 +61,26 @@
 	public void setF3(short f3) {
 		this.f3 = f3;
 	}
-	public DefaultFieldAccessBase getF4() {
+	public ImplicitFieldAccessBase getF4() {
 		return f4;
 	}
-	public void setF4(DefaultFieldAccessBase f4) {
+	public void setF4(ImplicitFieldAccessBase f4) {
 		this.f4 = f4;
 	}
 	
 	@Access(AccessType.PROPERTY)
 	@OneToOne
-	public DefaultFieldAccessBase getF5() {
+	public ImplicitFieldAccessBase getF5() {
 		return f5;
 	}
-	public void setF5(DefaultFieldAccessBase f5) {
+	public void setF5(ImplicitFieldAccessBase f5) {
 		this.f5 = f5;
 	}
 	
-	public DefaultFieldAccessBase getF6() {
+	public ImplicitFieldAccessBase getF6() {
 		return f6;
 	}
-	public void setF6(DefaultFieldAccessBase f6) {
+	public void setF6(ImplicitFieldAccessBase f6) {
 		this.f6 = f6;
 	}
 }

Copied: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ExplicitPropertyAccess.java
(from r766946, openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/ExplicitPropertyAccess.java)
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ExplicitPropertyAccess.java?p2=openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ExplicitPropertyAccess.java&p1=openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/ExplicitPropertyAccess.java&r1=766946&r2=769549&rev=769549&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/ExplicitPropertyAccess.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ExplicitPropertyAccess.java
Tue Apr 28 21:21:52 2009
@@ -40,8 +40,8 @@
 	private long f2;
 	private String f3;
 	private String f4;
-	private DefaultFieldAccessBase f5;
-	private DefaultFieldAccessBase f6;
+	private ImplicitFieldAccessBase f5;
+	private ImplicitFieldAccessBase f6;
 	
 	public String getF1() {
 		return f1;
@@ -69,18 +69,18 @@
 		this.f4 = f4;
 	}
 	@OneToOne
-	public DefaultFieldAccessBase getF5() {
+	public ImplicitFieldAccessBase getF5() {
 		return f5;
 	}
-	public void setF5(DefaultFieldAccessBase f5) {
+	public void setF5(ImplicitFieldAccessBase f5) {
 		this.f5 = f5;
 	}
 	@OneToOne
-	public DefaultFieldAccessBase getF6() {
+	public ImplicitFieldAccessBase getF6() {
 		return f6;
 	}
 	
-	public void setF6(DefaultFieldAccessBase f6) {
+	public void setF6(ImplicitFieldAccessBase f6) {
 		this.f6 = f6;
 	}
 }

Copied: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ExplicitPropertyAccessMixed.java
(from r766946, openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/ExplicitPropertyAccessMixed.java)
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ExplicitPropertyAccessMixed.java?p2=openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ExplicitPropertyAccessMixed.java&p1=openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/ExplicitPropertyAccessMixed.java&r1=766946&r2=769549&rev=769549&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/ExplicitPropertyAccessMixed.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ExplicitPropertyAccessMixed.java
Tue Apr 28 21:21:52 2009
@@ -41,10 +41,10 @@
 	
 	@Access(AccessType.FIELD)
 	@OneToOne
-	private DefaultFieldAccessBase f3;
+	private ImplicitFieldAccessBase f3;
 	private int f4;
 	private short f5;
-	private DefaultFieldAccessBase f6;
+	private ImplicitFieldAccessBase f6;
 	
 	public String getF1() {
 		return f1;
@@ -60,10 +60,10 @@
 		this.f2 = f2;
 	}
 	
-	public DefaultFieldAccessBase getF3() {
+	public ImplicitFieldAccessBase getF3() {
 		return f3;
 	}
-	public void setF3(DefaultFieldAccessBase f3) {
+	public void setF3(ImplicitFieldAccessBase f3) {
 		this.f3 = f3;
 	}
 	
@@ -82,10 +82,10 @@
 	}
 	
 	@OneToOne
-	public DefaultFieldAccessBase getF6() {
+	public ImplicitFieldAccessBase getF6() {
 		return f6;
 	}
-	public void setF6(DefaultFieldAccessBase f6) {
+	public void setF6(ImplicitFieldAccessBase f6) {
 		this.f6 = f6;
 	}
 }

Copied: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ImplicitFieldAccessBase.java
(from r765245, openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/DefaultFieldAccessBase.java)
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ImplicitFieldAccessBase.java?p2=openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ImplicitFieldAccessBase.java&p1=openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/DefaultFieldAccessBase.java&r1=765245&r2=769549&rev=769549&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/DefaultFieldAccessBase.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ImplicitFieldAccessBase.java
Tue Apr 28 21:21:52 2009
@@ -28,18 +28,22 @@
 import javax.persistence.ManyToMany;
 import javax.persistence.OneToMany;
 import javax.persistence.OneToOne;
+import javax.persistence.Transient;
 
 /**
  * Domain classes used by meta-model testing.
  * 
- * Uses default, field based access type.
+ * Uses implicit, field based access type.
+ * 
+ * Implicit access is determined by placement of annotations of field or 
+ * getters.
  * 
  * @author Pinaki Poddar
  *
  */
 @Entity
-public class DefaultFieldAccessBase extends DefaultFieldAccessMappedSuperclass {
-    private String   string;
+public class ImplicitFieldAccessBase extends ImplicitFieldAccessMappedSuperclass {
+    private String   f0;
     private int      primitiveInt;
     private Integer  boxedInt;
     
@@ -57,11 +61,11 @@
     @ManyToMany
     private Map<Integer, ExplicitFieldAccess> mapRelationKeyBasic;
     
-	public String getString() {
-		return string;
+	public String getF0() {
+		return f0;
 	}
-	public void setString(String string) {
-		this.string = string;
+	public void setF0(String string) {
+		this.f0 = string;
 	}
 	public int getPrimitiveInt() {
 		return primitiveInt;
@@ -117,4 +121,16 @@
 			ExplicitFieldAccess> map) {
 		this.mapRelationKeyBasic = map;
 	}
+	
+	// This method is annotated but transient to verify that placement of
+	// annotation does not confuse the determination of implicit access
+	// style of this class.
+	@Transient
+	public int getTransient() {
+		return 42;
+	}
+	
+	public void setTransient(int x) {
+		
+	}
 }

Copied: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ImplicitFieldAccessMappedSuperclass.java
(from r765245, openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/DefaultFieldAccessMappedSuperclass.java)
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ImplicitFieldAccessMappedSuperclass.java?p2=openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ImplicitFieldAccessMappedSuperclass.java&p1=openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/DefaultFieldAccessMappedSuperclass.java&r1=765245&r2=769549&rev=769549&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/DefaultFieldAccessMappedSuperclass.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ImplicitFieldAccessMappedSuperclass.java
Tue Apr 28 21:21:52 2009
@@ -25,13 +25,14 @@
 /**
  * Domain class used by meta-model testing.
  * 
- * Uses default field based access.
+ * Uses implicit field based access.
+ * Implicit access is determined by placement of annotation on field or method.
  * 
  * @author Pinaki Poddar
  *
  */
 @MappedSuperclass
-public class DefaultFieldAccessMappedSuperclass {
+public class ImplicitFieldAccessMappedSuperclass {
     @Id
     private long id;
     

Copied: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ImplicitFieldAccessSubclass.java
(from r765245, openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/DefaultFieldAccessSubclass.java)
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ImplicitFieldAccessSubclass.java?p2=openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ImplicitFieldAccessSubclass.java&p1=openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/DefaultFieldAccessSubclass.java&r1=765245&r2=769549&rev=769549&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/test/java/org/apache/openjpa/persistence/meta/DefaultFieldAccessSubclass.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ImplicitFieldAccessSubclass.java
Tue Apr 28 21:21:52 2009
@@ -28,26 +28,26 @@
 /**
  * Domain class used y meta-model testing.
  * 
- * Uses default field based access.
+ * Uses implicit field based access.
  *  
  * @author Pinaki Poddar
  *
  */
 @Entity
-public class DefaultFieldAccessSubclass extends DefaultFieldAccessBase {
-    private DefaultFieldAccessBase base;
+public class ImplicitFieldAccessSubclass extends ImplicitFieldAccessBase {
+    @OneToOne
+    private ImplicitFieldAccessBase base;
+	@ManyToMany
     private Map<Embed0, ExplicitPropertyAccess> mapRelationKeyEmbedded;
     
-    @OneToOne
-	public DefaultFieldAccessBase getBase() {
+	public ImplicitFieldAccessBase getBase() {
 		return base;
 	}
 	
-	public void setBase(DefaultFieldAccessBase base) {
+	public void setBase(ImplicitFieldAccessBase base) {
 		this.base = base;
 	}
 	
-	@ManyToMany
 	public Map<Embed0, ExplicitPropertyAccess> getMapRelationKeyEmbedded() {
 		return mapRelationKeyEmbedded;
 	}

Added: 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=769549&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/TestMetamodel.java
(added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/TestMetamodel.java
Tue Apr 28 21:21:52 2009
@@ -0,0 +1,202 @@
+/*
+ * 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.meta;
+
+import javax.persistence.metamodel.Attribute;
+import javax.persistence.metamodel.Collection;
+import javax.persistence.metamodel.List;
+import javax.persistence.metamodel.ManagedType;
+import javax.persistence.metamodel.Set;
+import javax.persistence.metamodel.AbstractCollection.CollectionType;
+import javax.persistence.metamodel.AbstractCollection.Multiplicity;
+import javax.persistence.metamodel.Bindable.BindableType;
+import javax.persistence.metamodel.Type.PersistenceType;
+
+import org.apache.openjpa.meta.ClassMetaData;
+import org.apache.openjpa.persistence.test.SingleEMFTestCase;
+
+/**
+ * Tests JPA 2.0 Metamodel.
+ * 
+ * @author Pinaki Poddar
+ *
+ */
+public class TestMetamodel extends SingleEMFTestCase {
+    MetamodelImpl model;
+    
+    public void setUp() {
+    	super.setUp(
+    			ImplicitFieldAccessMappedSuperclass.class,
+    	        ImplicitFieldAccessBase.class, 
+    	        ImplicitFieldAccessSubclass.class,
+    	        ExplicitFieldAccess.class, 
+    	        ExplicitPropertyAccess.class,
+    	        Embed0.class, 
+    	        Embed1.class);
+    	emf.createEntityManager();
+        model = (MetamodelImpl)emf.getMetamodel();
+    }
+    
+    public void testModelIsPopulated() {
+        assertFalse(model.getEntities().isEmpty());
+        assertFalse(model.getEmbeddables().isEmpty());
+        assertFalse(model.getManagedTypes().isEmpty());
+    }
+    
+    public void testPersistentCategory() {
+    	assertCategory(PersistenceType.MAPPED_SUPERCLASS, 
+    			ImplicitFieldAccessMappedSuperclass.class);
+    	assertCategory(PersistenceType.ENTITY, ImplicitFieldAccessBase.class);
+    	assertCategory(PersistenceType.ENTITY, ImplicitFieldAccessSubclass.class);
+    	assertCategory(PersistenceType.EMBEDDABLE, Embed0.class);
+    	assertCategory(PersistenceType.EMBEDDABLE, Embed1.class);
+    	
+        assertNotNull(model.entity(ImplicitFieldAccessBase.class));
+        assertNotNull(model.entity(ImplicitFieldAccessSubclass.class));      
+        assertNotNull(model.embeddable(Embed0.class));
+        assertNotNull(model.embeddable(Embed1.class));
+        
+        java.util.Set<ManagedType<?>> managedTypes = model.getManagedTypes();
+        managedTypes.removeAll(model.getEmbeddables());
+        managedTypes.removeAll(model.getEntities());
+        assertNotNull(model.type(ImplicitFieldAccessMappedSuperclass.class));
+        assertTrue(managedTypes.contains(
+        		model.type(ImplicitFieldAccessMappedSuperclass.class)));
+    }
+    
+    public void testAttributeByNameAndType() {
+        ManagedType<ImplicitFieldAccessBase> e0 = model.entity(
+        		ImplicitFieldAccessBase.class);
+        assertNotNull(e0.getAttribute("f0"));
+        assertNotNull(e0.getAttribute("f0", String.class));
+        assertSame(e0.getAttribute("f0"), e0.getAttribute("f0", String.class));
+        try {
+            e0.getAttribute("f0", ExplicitFieldAccess.class);
+            fail("Expected IllegalArgumentException");
+        } catch (IllegalArgumentException e) {
+            
+        }
+        ManagedType<ImplicitFieldAccessSubclass> e1 = model.entity(
+        		ImplicitFieldAccessSubclass.class);
+        assertNotNull(e1.getAttribute("f0"));
+        
+    }
+    
+    public void testAttributeByDeclaration() {
+        ManagedType<ImplicitFieldAccessBase> e0 = 
+        	model.entity(ImplicitFieldAccessBase.class);
+        ManagedType<ImplicitFieldAccessSubclass> e1 = 
+        	model.entity(ImplicitFieldAccessSubclass.class);
+        assertNotNull(e0.getAttribute("f0"));
+        assertNotNull(e1.getAttribute("f0"));
+        assertNotNull(e0.getAttribute("f0", String.class));
+        assertNotNull(e1.getAttribute("f0", String.class));
+        assertSame(e0.getAttribute("f0"), e0.getAttribute("f0", String.class));
+        assertSame(e1.getAttribute("f0"), e1.getAttribute("f0", String.class));
+        assertNotSame(e0.getAttribute("f0"), e1.getAttribute("f0"));
+        assertNotSame(e0.getAttribute("f0", String.class), e1.getAttribute("f0", String.class));
+        assertNotNull(e0.getDeclaredAttribute("f0"));
+        try {
+            e1.getDeclaredAttribute("f0");
+            fail("Expected IllegalArgumentException");
+        } catch (IllegalArgumentException e) {
+            
+        }
+    }
+    
+    public void testPCCollection() {
+        ManagedType<ImplicitFieldAccessBase> e0 = model.entity(ImplicitFieldAccessBase.class);
+        ManagedType<ExplicitFieldAccess> r1 = model.entity(ExplicitFieldAccess.class);
+        Collection relColl 
+          = e0.getCollection("collectionRelation", ExplicitFieldAccess.class);
+        assertEquals(CollectionType.COLLECTION, relColl.getCollectionType());
+        assertEquals(e0, relColl.getDeclaringType());
+        assertEquals(r1, relColl.getElementType());
+        assertEquals(java.util.Collection.class, relColl.getMemberJavaType());
+        assertEquals(BindableType.COLLECTION, relColl.getBindableType());
+        assertEquals(Multiplicity.ONE_TO_MANY, relColl.getMultiplicity());
+    }
+    
+    public void testPCList() {
+        ManagedType<ImplicitFieldAccessBase> e0 = model.entity(ImplicitFieldAccessBase.class);
+        ManagedType<ExplicitFieldAccess> r1 = model.entity(ExplicitFieldAccess.class);
+        List relList = e0.getList("listRelation", ExplicitFieldAccess.class);
+        assertEquals(CollectionType.LIST, relList.getCollectionType());
+        assertEquals(e0, relList.getDeclaringType());
+        assertEquals(r1, relList.getElementType());
+        assertEquals(java.util.List.class, relList.getMemberJavaType());
+        assertEquals(BindableType.COLLECTION, relList.getBindableType());
+        assertEquals(Multiplicity.ONE_TO_MANY, relList.getMultiplicity());
+    }
+    
+    public void testPCSet() {
+        ManagedType<ImplicitFieldAccessBase> e0 = 
+        	model.entity(ImplicitFieldAccessBase.class);
+        ManagedType<ExplicitFieldAccess> r1 = 
+        	model.entity(ExplicitFieldAccess.class);
+        Set relSet = e0.getSet("setRelation", ExplicitFieldAccess.class);
+        assertEquals(CollectionType.SET, relSet.getCollectionType());
+        assertEquals(e0, relSet.getDeclaringType());
+        assertEquals(r1, relSet.getElementType());
+        assertEquals(java.util.Set.class, relSet.getMemberJavaType());
+        assertEquals(BindableType.COLLECTION, relSet.getBindableType());
+        assertEquals(Multiplicity.ONE_TO_MANY, relSet.getMultiplicity());
+    }
+    
+    public void testDeclaredFields() {
+        ManagedType<ImplicitFieldAccessSubclass> e1 = 
+        	model.entity(ImplicitFieldAccessSubclass.class);
+        java.util.Set all = e1.getAttributes();
+        java.util.Set decl = e1.getDeclaredAttributes();
+        assertTrue(all.size() > decl.size());
+        all.removeAll(decl);
+        System.err.println(all);
+    }
+    
+    public void testNonExistentField() {
+        ManagedType<ImplicitFieldAccessBase> e0 = 
+        	model.entity(ImplicitFieldAccessBase.class);
+        ManagedType<ImplicitFieldAccessSubclass> e1 = 
+        	model.entity(ImplicitFieldAccessSubclass.class);
+        assertFails(e0, "xyz", false);
+        assertFails(e1, "f0", true);
+        
+    }
+    
+    void assertFails(ManagedType type, String name, boolean dec) {
+        try {
+            Attribute a = dec ? type.getDeclaredAttribute(name) 
+                : type.getAttribute(name);
+            fail("Expected to fail " + name + " on " + type);
+        } catch (IllegalArgumentException e) {
+            System.err.println(e);
+        }
+    }
+    
+    
+    PersistenceType categorize(Class<?> c) {
+        ClassMetaData meta = model.repos.getCachedMetaData(c);
+        return MetamodelImpl.getPersistenceType(meta);
+    }
+    
+    void assertCategory(PersistenceType category, Class<?> cls) {
+    	assertEquals(category, categorize(cls));
+    }
+}

Propchange: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/TestMetamodel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: openjpa/trunk/openjpa-persistence/pom.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/pom.xml?rev=769549&r1=769548&r2=769549&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/pom.xml (original)
+++ openjpa/trunk/openjpa-persistence/pom.xml Tue Apr 28 21:21:52 2009
@@ -58,10 +58,10 @@
 		    		<groupId>org.apache.maven.plugins</groupId>
 		    		<artifactId>maven-compiler-plugin</artifactId>
 		            <configuration>
-                    <excludes>
+                      <excludes>
                         <exclude>**/AnnotationProcessor6.java</exclude>
                         <exclude>**/SourceAnnotationHandler.java</exclude>
-                    </excludes>
+                      </excludes>
 		            </configuration>
 		        </plugin>
 		      </plugins>

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/MetamodelImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/MetamodelImpl.java?rev=769549&r1=769548&r2=769549&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/MetamodelImpl.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/MetamodelImpl.java
Tue Apr 28 21:21:52 2009
@@ -48,10 +48,10 @@
 
     public MetamodelImpl(MetaDataRepository repos) {
         this.repos = repos;
-        ClassMetaData[] metas = repos.getMetaDatas();
-        for (ClassMetaData meta : metas) {
+        Collection<Class<?>> classes = repos.loadPersistentTypes(true, null);
+        for (Class<?> cls : classes) {
+        	ClassMetaData meta = repos.getMetaData(cls, null, true);
             PersistenceType type = getPersistenceType(meta);
-            Class<?> cls = meta.getDescribedType();
             switch (type) {
             case ENTITY:
                 find(cls, _entities, ENTITY);



Mime
View raw message