cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r427878 - in /incubator/cayenne/main/trunk/core/cayenne-jpa/src: main/java/org/apache/cayenne/jpa/conf/ main/java/org/apache/cayenne/jpa/map/ test/java/org/apache/cayenne/jpa/conf/ test/java/org/apache/cayenne/jpa/entity/ test/resources/xml...
Date Wed, 02 Aug 2006 03:48:10 GMT
Author: aadamchik
Date: Tue Aug  1 20:48:10 2006
New Revision: 427878

URL: http://svn.apache.org/viewvc?rev=427878&view=rev
Log:
a number of fixes to the annotations loader

Modified:
    incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/conf/ClassAnnotationProcessorFactory.java
    incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/conf/MemberAnnotationProcessorFactory.java
    incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaClassDescriptor.java
    incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/java/org/apache/cayenne/jpa/conf/EntityMapAnnotationLoaderTest.java
    incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/java/org/apache/cayenne/jpa/entity/MockMappedSuperclass1.java
    incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/resources/xml-samples/orm-schema-headers-full.xml

Modified: incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/conf/ClassAnnotationProcessorFactory.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/conf/ClassAnnotationProcessorFactory.java?rev=427878&r1=427877&r2=427878&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/conf/ClassAnnotationProcessorFactory.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/conf/ClassAnnotationProcessorFactory.java
Tue Aug  1 20:48:10 2006
@@ -17,7 +17,6 @@
  *  under the License.
  ****************************************************************/
 
-
 package org.apache.cayenne.jpa.conf;
 
 import java.lang.reflect.AnnotatedElement;
@@ -313,8 +312,11 @@
                     listenerLoader = new EntityListenerAnnotationLoader();
                 }
 
-                // superclass takes care of creating a non-null instance lazily
                 JpaEntityListeners listenerHolder = superclass.getEntityListeners();
+                if(listenerHolder  == null) {
+                    listenerHolder = new JpaEntityListeners();
+                    superclass.setEntityListeners(listenerHolder);
+                }
 
                 for (int i = 0; i < annotation.value().length; i++) {
                     JpaEntityListener listener = listenerLoader

Modified: incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/conf/MemberAnnotationProcessorFactory.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/conf/MemberAnnotationProcessorFactory.java?rev=427878&r1=427877&r2=427878&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/conf/MemberAnnotationProcessorFactory.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/conf/MemberAnnotationProcessorFactory.java
Tue Aug  1 20:48:10 2006
@@ -28,6 +28,7 @@
 import javax.persistence.GeneratedValue;
 import javax.persistence.Temporal;
 
+import org.apache.cayenne.jpa.map.JpaAbstractEntity;
 import org.apache.cayenne.jpa.map.JpaAttributeOverride;
 import org.apache.cayenne.jpa.map.JpaAttributes;
 import org.apache.cayenne.jpa.map.JpaColumn;
@@ -72,8 +73,9 @@
             JpaEmbeddedId id = new JpaEmbeddedId();
 
             Object parent = context.peek();
-            if (parent instanceof JpaEntity) {
-                ((JpaEntity) parent).getAttributes().setEmbeddedId(id);
+            // only JpaEntity and JpaMappedSuperclass can have it
+            if (parent instanceof JpaAbstractEntity) {
+                ((JpaAbstractEntity) parent).getAttributes().setEmbeddedId(id);
             }
             else {
                 context.recordConflict(element, AnnotationProcessorFactory

Modified: incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaClassDescriptor.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaClassDescriptor.java?rev=427878&r1=427877&r2=427878&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaClassDescriptor.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaClassDescriptor.java
Tue Aug  1 20:48:10 2006
@@ -17,7 +17,6 @@
  *  under the License.
  ****************************************************************/
 
-
 package org.apache.cayenne.jpa.map;
 
 import java.lang.reflect.Field;
@@ -32,7 +31,8 @@
 import java.util.regex.Pattern;
 
 /**
- * Provides the JPA information about a class, such potential persistence fields, etc.
+ * Provides information about a class relevant to JPA, such potential persistence fields,
+ * etc.
  * 
  * @author Andrus Adamchik
  */

Modified: incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/java/org/apache/cayenne/jpa/conf/EntityMapAnnotationLoaderTest.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/java/org/apache/cayenne/jpa/conf/EntityMapAnnotationLoaderTest.java?rev=427878&r1=427877&r2=427878&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/java/org/apache/cayenne/jpa/conf/EntityMapAnnotationLoaderTest.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/java/org/apache/cayenne/jpa/conf/EntityMapAnnotationLoaderTest.java
Tue Aug  1 20:48:10 2006
@@ -41,7 +41,6 @@
 import org.apache.cayenne.jpa.entity.MockMappedSuperclass2;
 import org.apache.cayenne.jpa.entity.MockMappedSuperclass3;
 import org.apache.cayenne.jpa.map.JpaAttributeOverride;
-import org.apache.cayenne.jpa.map.JpaAttributes;
 import org.apache.cayenne.jpa.map.JpaEntity;
 import org.apache.cayenne.jpa.map.JpaEntityMap;
 import org.apache.cayenne.jpa.spi.MockPersistenceUnitInfo;
@@ -85,15 +84,6 @@
                 .iterator()
                 .next();
         assertEquals("entityAttribute", entityOverride.getName());
-
-        JpaAttributes attributes = entity.getAttributes();
-        assertEquals(1, attributes.getBasicAttributes().size());
-        assertEquals(1, entity.getAttributeOverrides().size());
-        JpaAttributeOverride attributeOverride = entity
-                .getAttributeOverrides()
-                .iterator()
-                .next();
-        assertEquals("embdeddedAttribute", attributeOverride.getName());
     }
 
     /**

Modified: incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/java/org/apache/cayenne/jpa/entity/MockMappedSuperclass1.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/java/org/apache/cayenne/jpa/entity/MockMappedSuperclass1.java?rev=427878&r1=427877&r2=427878&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/java/org/apache/cayenne/jpa/entity/MockMappedSuperclass1.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/java/org/apache/cayenne/jpa/entity/MockMappedSuperclass1.java
Tue Aug  1 20:48:10 2006
@@ -20,13 +20,9 @@
 
 package org.apache.cayenne.jpa.entity;
 
-import javax.persistence.Column;
 import javax.persistence.EntityListeners;
 import javax.persistence.ExcludeDefaultListeners;
 import javax.persistence.ExcludeSuperclassListeners;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
 import javax.persistence.IdClass;
 import javax.persistence.MappedSuperclass;
 import javax.persistence.PostLoad;
@@ -36,8 +32,6 @@
 import javax.persistence.PrePersist;
 import javax.persistence.PreRemove;
 import javax.persistence.PreUpdate;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
 
 @MappedSuperclass
 @IdClass(MockIdClass.class)
@@ -47,11 +41,6 @@
     MockEntityListener1.class
 })
 public class MockMappedSuperclass1 {
-    @Id
-    @Temporal(TemporalType.TIME)
-    @Column(name = "id_column", unique = true, nullable = true, insertable = true, updatable
= true, table = "id_table", length = 3, precision = 4, scale = 5)
-    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "id-generator")
-    protected int id1;
 
     @PrePersist
     protected void eprePersist() {

Modified: incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/resources/xml-samples/orm-schema-headers-full.xml
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/resources/xml-samples/orm-schema-headers-full.xml?rev=427878&r1=427877&r2=427878&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/resources/xml-samples/orm-schema-headers-full.xml
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/resources/xml-samples/orm-schema-headers-full.xml
Tue Aug  1 20:48:10 2006
@@ -137,14 +137,14 @@
 	<!-- MAPPED SUPERCLASS WITH EMBEDDED Id -->
 	<mapped-superclass class="org.apache.cayenne.jpa.entity.MockMappedSuperclass2">
 		<attributes>
-		<embedded-id name="embeddedId">
-			<attribute-override name="attribute1">
-				<column name="ao_column1"/>
-			</attribute-override>
-			<attribute-override name="attribute2">
-				<column name="ao_column2"/>
-			</attribute-override>
-		</embedded-id>
+			<embedded-id name="embeddedId">
+				<attribute-override name="attribute1">
+					<column name="ao_column1"/>
+				</attribute-override>
+				<attribute-override name="attribute2">
+					<column name="ao_column2"/>
+				</attribute-override>
+			</embedded-id>
 		</attributes>
 	</mapped-superclass>
 	



Mime
View raw message