tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1414455 - in /openejb/trunk/openejb/container: openejb-core/src/main/java/org/apache/openejb/assembler/classic/ReloadableEntityManagerFactory.java openejb-jee/src/main/java/org/apache/openejb/jee/jpa/unit/PersistenceUnit.java
Date Tue, 27 Nov 2012 22:57:36 GMT
Author: rmannibucau
Date: Tue Nov 27 22:57:35 2012
New Revision: 1414455

URL: http://svn.apache.org/viewvc?rev=1414455&view=rev
Log:
TOMEE-612 use javax.persistence.validation.mode is validationMode is not set in persistence.xml

Modified:
    openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ReloadableEntityManagerFactory.java
    openejb/trunk/openejb/container/openejb-jee/src/main/java/org/apache/openejb/jee/jpa/unit/PersistenceUnit.java

Modified: openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ReloadableEntityManagerFactory.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ReloadableEntityManagerFactory.java?rev=1414455&r1=1414454&r2=1414455&view=diff
==============================================================================
--- openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ReloadableEntityManagerFactory.java
(original)
+++ openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ReloadableEntityManagerFactory.java
Tue Nov 27 22:57:35 2012
@@ -499,7 +499,8 @@ public class ReloadableEntityManagerFact
                 ValidationMode mode = ValidationMode.valueOf(value.trim().toUpperCase());
                 reloadableEntityManagerFactory.setValidationMode(mode);
             } catch (Exception iae) {
-                // ignored
+                LOGGER.warning("Can't set validation mode " + value, iae);
+                reloadableEntityManagerFactory.setProperty(JAVAX_PERSISTENCE_VALIDATION_MODE,
value);
             }
         }
 

Modified: openejb/trunk/openejb/container/openejb-jee/src/main/java/org/apache/openejb/jee/jpa/unit/PersistenceUnit.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-jee/src/main/java/org/apache/openejb/jee/jpa/unit/PersistenceUnit.java?rev=1414455&r1=1414454&r2=1414455&view=diff
==============================================================================
--- openejb/trunk/openejb/container/openejb-jee/src/main/java/org/apache/openejb/jee/jpa/unit/PersistenceUnit.java
(original)
+++ openejb/trunk/openejb/container/openejb-jee/src/main/java/org/apache/openejb/jee/jpa/unit/PersistenceUnit.java
Tue Nov 27 22:57:35 2012
@@ -275,6 +275,16 @@ public class PersistenceUnit {
     }
 
     public ValidationMode getValidationMode() {
+        if (validationMode == null) {
+            final String propConfig = getProperty("javax.persistence.validation.mode");
+            if (propConfig != null) {
+                try {
+                    validationMode = ValidationMode.valueOf(propConfig.toUpperCase());
+                } catch (IllegalArgumentException iae) { // can happen since some provider
allow more than the enum
+                    // no-op
+                }
+            }
+        }
         return (validationMode == null) ? ValidationMode.AUTO : validationMode;
     }
 



Mime
View raw message