openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ppod...@apache.org
Subject svn commit: r487652 - in /incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence: AnnotationPersistenceMetaDataParser.java PersistenceMetaDataDefaults.java XMLPersistenceMetaDataParser.java
Date Fri, 15 Dec 2006 20:35:26 GMT
Author: ppoddar
Date: Fri Dec 15 12:35:26 2006
New Revision: 487652

URL: http://svn.apache.org/viewvc?view=rev&rev=487652
Log:
A single class may not have more than one lifecycle callback method for the same lifecycle
event (spec section 3.5).
The contraint applies irrespective of whether the class is a persistent bean or a listener
or both. 


Modified:
    incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java
    incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java
    incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java

Modified: incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java?view=diff&rev=487652&r1=487651&r2=487652
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java
(original)
+++ incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java
Fri Dec 15 12:35:26 2006
@@ -815,9 +815,9 @@
                     int e = events[i];
                     if (callbacks[e] == null)
                         callbacks[e] = new ArrayList(3);
+                    MetaDataParsers.validateMethodsForSameCallback(cls, 
+                        callbacks[e], m, tag, def, repos.getLog());
                     if (listener) {
-                        MetaDataParsers.validateMethodsForSameCallback(cls, 
-                            callbacks[e], m, tag, def, repos.getLog());
                         callbacks[e].add(new BeanLifecycleCallbacks(cls, m,
                             false));
                     } else {

Modified: incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java?view=diff&rev=487652&r1=487651&r2=487652
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java
(original)
+++ incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java
Fri Dec 15 12:35:26 2006
@@ -61,7 +61,7 @@
 public class PersistenceMetaDataDefaults
     extends AbstractMetaDataDefaults {
 
-    private boolean _allowsMultipleMethodsForSameCallback = true;
+    private boolean _allowsMultipleMethodsForSameCallback = false;
 
     private static Localizer _loc = Localizer.forPackage
         (PersistenceMetaDataDefaults.class);

Modified: incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java?view=diff&rev=487652&r1=487651&r2=487652
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java
(original)
+++ incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java
Fri Dec 15 12:35:26 2006
@@ -86,7 +86,8 @@
     protected static final String ELEM_CASCADE_REF = "cascade-refresh";
     protected static final String ELEM_PU_META = "persistence-unit-metadata";
     protected static final String ELEM_PU_DEF = "persistence-unit-defaults";
-    protected static final String ELEM_XML_MAP_META_COMPLETE = "xml-mapping-metadata-complete";
+    protected static final String ELEM_XML_MAP_META_COMPLETE = 
+        "xml-mapping-metadata-complete";
 
     private static final Map<String, Object> _elems =
         new HashMap<String, Object>();
@@ -1582,6 +1583,11 @@
                 MetaDataParsers.validateMethodsForSameCallback(_listener, 
                     _callbacks[event], ((BeanLifecycleCallbacks) adapter).
                     getCallbackMethod(), callback, def, getLog());
+            } else {
+                MetaDataParsers.validateMethodsForSameCallback(_cls, 
+                    _callbacks[event], ((MethodLifecycleCallbacks) adapter).
+                    getCallbackMethod(), callback, def, getLog());
+                
             }
             if (_callbacks[event] == null)
                 _callbacks[event] = new ArrayList<LifecycleCallbacks>(3);



Mime
View raw message