openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jrba...@apache.org
Subject svn commit: r802062 - in /openjpa/trunk: openjpa-integration/validation/src/main/ant/ openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/ openjpa-integration/validation/src/test/resources/META-INF/ openjpa-integratio...
Date Fri, 07 Aug 2009 16:06:18 GMT
Author: jrbauer
Date: Fri Aug  7 16:06:17 2009
New Revision: 802062

URL: http://svn.apache.org/viewvc?rev=802062&view=rev
Log:
OPENJPA-1157 Added test which contains uses constraints and persistence metadata defined in
XML.  Updated ValidatorImpl to trace exceptions thrown as a result of creating the default
validator factory.

Added:
    openjpa/trunk/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestMappedSuper.java
  (with props)
    openjpa/trunk/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/XMLBase.java
  (with props)
    openjpa/trunk/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/XMLSuper.java
  (with props)
    openjpa/trunk/openjpa-integration/validation/src/test/resources/META-INF/
    openjpa/trunk/openjpa-integration/validation/src/test/resources/META-INF/ehn-persistence.xml
  (with props)
    openjpa/trunk/openjpa-integration/validation/src/test/resources/META-INF/validation.xml
  (with props)
    openjpa/trunk/openjpa-integration/validation/src/test/resources/org/apache/openjpa/integration/validation/constraints.xml
  (with props)
    openjpa/trunk/openjpa-integration/validation/src/test/resources/org/apache/openjpa/integration/validation/validation-orm.xml
  (with props)
Modified:
    openjpa/trunk/openjpa-integration/validation/src/main/ant/enhancer.xml
    openjpa/trunk/openjpa-integration/validation/src/test/resources/org/apache/openjpa/integration/validation/persistence.xml
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/validation/ValidatorImpl.java
    openjpa/trunk/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/validation/localizer.properties

Modified: openjpa/trunk/openjpa-integration/validation/src/main/ant/enhancer.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-integration/validation/src/main/ant/enhancer.xml?rev=802062&r1=802061&r2=802062&view=diff
==============================================================================
--- openjpa/trunk/openjpa-integration/validation/src/main/ant/enhancer.xml (original)
+++ openjpa/trunk/openjpa-integration/validation/src/main/ant/enhancer.xml Fri Aug  7 16:06:17
2009
@@ -81,11 +81,23 @@
             <exclude name="**/Unenhanced*.class" />
             <exclude name="**/AbstractUnenhanced*.class" />
             <exclude name="**/unenhanced/*.class" />
+			<exclude name="**/XMLBase.class"/>
+			<exclude name="**/XMLSuper.class"/>
         </fileset>
         <openjpac>
             <classpath refid="cp" />
             <fileset refid="enhance.path.ref" />
             <config log="DefaultLevel=${openjpa.loglevel}" />
         </openjpac>
+        <openjpac>
+        	<!-- enhance XML-defined pc's separately since they use their own mapping file
-->
+            <config propertiesFile="${project.build.testOutputDirectory}/META-INF/ehn-persistence.xml"
/>
+            <classpath refid="cp" />
+            <fileset dir="${project.build.testOutputDirectory}">
+				<include name="**/XMLBase.class"/>
+				<include name="**/XMLSuper.class"/>
+            </fileset>
+            <config log="DefaultLevel=${openjpa.loglevel}" />
+        </openjpac>
     </target>
 </project>

Added: openjpa/trunk/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestMappedSuper.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestMappedSuper.java?rev=802062&view=auto
==============================================================================
--- openjpa/trunk/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestMappedSuper.java
(added)
+++ openjpa/trunk/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestMappedSuper.java
Fri Aug  7 16:06:17 2009
@@ -0,0 +1,102 @@
+/*
+ * 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.integration.validation;
+
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.ConstraintViolationException;
+import javax.validation.Validation;
+
+import org.apache.openjpa.persistence.OpenJPAEntityManager;
+import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
+import org.apache.openjpa.persistence.OpenJPAPersistence;
+import org.apache.openjpa.persistence.test.AllowFailure;
+import org.apache.openjpa.persistence.test.PersistenceTestCase;
+
+
+public class TestMappedSuper extends PersistenceTestCase {
+
+    /*
+     * Verify constraints defined via XML on a mapped superclass are validated.
+     */
+    @AllowFailure(message="This test currently fails with the CR3 version of" +
+        " the RI.  See: https://forum.hibernate.org/viewtopic.php?f=26&t=998810")
+    public void testMappedSuperXMLConstraint() {
+        OpenJPAEntityManagerFactorySPI emf = (OpenJPAEntityManagerFactorySPI) 
+        OpenJPAPersistence.createEntityManagerFactory(
+                "XMLConstraintPU",
+                "org/apache/openjpa/integration/validation/persistence.xml");
+        assertNotNull(emf);
+        OpenJPAEntityManager em = emf.createEntityManager();
+        assertNotNull(em);
+        
+        XMLBase be = new XMLBase();
+        try {
+            em.getTransaction().begin();
+            em.persist(be);
+            em.getTransaction().commit();
+            fail("Should have caught a ConstraintViolationException");
+        }
+        catch (ConstraintViolationException e) {
+            checkCVE(e, "superStrValue", "strValue");
+            if (em.getTransaction().isActive()) {
+                em.getTransaction().setRollbackOnly();
+            }
+        }
+        catch (Exception e) {
+            fail("Should have caught a ConstraintViolationException");
+        }
+        finally {
+            if (em.getTransaction().isActive()) {
+                em.getTransaction().rollback();
+            }
+            if (emf != null) {
+                clear(emf);
+                closeEMF(emf);
+            }
+        }
+    }
+    
+    private void checkCVE(ConstraintViolationException e,
+        String... vioProperties) {
+        Set<ConstraintViolation<?>>cvs = e.getConstraintViolations();
+        if (vioProperties.length == 0 && cvs == null)
+            return;
+        assertEquals(vioProperties.length, cvs.size());
+        Iterator<ConstraintViolation<?>> i = 
+            (Iterator<ConstraintViolation<?>>) cvs.iterator();
+        while (i.hasNext()) {
+            ConstraintViolation<?> v = (ConstraintViolation<?>)i.next();
+            boolean found = false;
+            for (String vio : vioProperties) {
+                if (v.getPropertyPath().toString().compareTo(vio) == 0) {
+                    found = true;
+                    break;
+                }
+            }
+            if (!found) {
+                fail("Unexpected ConstraintViolation for: " + 
+                    v.getPropertyPath());
+            }
+        }
+    }
+
+}

Propchange: openjpa/trunk/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/TestMappedSuper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openjpa/trunk/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/XMLBase.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/XMLBase.java?rev=802062&view=auto
==============================================================================
--- openjpa/trunk/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/XMLBase.java
(added)
+++ openjpa/trunk/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/XMLBase.java
Fri Aug  7 16:06:17 2009
@@ -0,0 +1,39 @@
+/*
+ * 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.integration.validation;
+
+public class XMLBase extends XMLSuper {
+   
+    private int id;        
+    private String strValue;
+    
+    public void setId(int id) {
+        this.id = id;
+    }
+    public int getId() {
+        return id;
+    }
+    
+    public void setStrValue(String strValue) {
+        this.strValue = strValue;
+    }
+    public String getStrValue() {
+        return strValue;
+    }    
+}

Propchange: openjpa/trunk/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/XMLBase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openjpa/trunk/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/XMLSuper.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/XMLSuper.java?rev=802062&view=auto
==============================================================================
--- openjpa/trunk/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/XMLSuper.java
(added)
+++ openjpa/trunk/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/XMLSuper.java
Fri Aug  7 16:06:17 2009
@@ -0,0 +1,31 @@
+/*
+ * 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.integration.validation;
+
+public class XMLSuper {
+
+    private String superStrValue;
+    
+    public void setSuperStrValue(String superStrValue) {
+        this.superStrValue = superStrValue;
+    }
+    public String getSuperStrValue() {
+        return superStrValue;
+    }   
+}

Propchange: openjpa/trunk/openjpa-integration/validation/src/test/java/org/apache/openjpa/integration/validation/XMLSuper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openjpa/trunk/openjpa-integration/validation/src/test/resources/META-INF/ehn-persistence.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-integration/validation/src/test/resources/META-INF/ehn-persistence.xml?rev=802062&view=auto
==============================================================================
--- openjpa/trunk/openjpa-integration/validation/src/test/resources/META-INF/ehn-persistence.xml
(added)
+++ openjpa/trunk/openjpa-integration/validation/src/test/resources/META-INF/ehn-persistence.xml
Fri Aug  7 16:06:17 2009
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.   
+-->
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    version="2.0">
+    <persistence-unit name="XMLConstraintPU">
+        <description>Persistence file used explicitly by the enhancer</description>
+        <mapping-file>org/apache/openjpa/integration/validation/validation-orm.xml</mapping-file>
+        <class>org.apache.openjpa.integration.validation.XMLBase</class>
+        <class>org.apache.openjpa.integration.validation.XMLSuper</class>
+    </persistence-unit>
+</persistence>

Propchange: openjpa/trunk/openjpa-integration/validation/src/test/resources/META-INF/ehn-persistence.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openjpa/trunk/openjpa-integration/validation/src/test/resources/META-INF/validation.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-integration/validation/src/test/resources/META-INF/validation.xml?rev=802062&view=auto
==============================================================================
--- openjpa/trunk/openjpa-integration/validation/src/test/resources/META-INF/validation.xml
(added)
+++ openjpa/trunk/openjpa-integration/validation/src/test/resources/META-INF/validation.xml
Fri Aug  7 16:06:17 2009
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.   
+-->
+<validation-config
+        xmlns="http://jboss.org/xml/ns/javax/validation/configuration"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation=
+            "http://jboss.org/xml/ns/javax/validation/configuration validation-configuration-1.0.xsd">
+    <constraint-mapping>org/apache/openjpa/integration/validation/constraints.xml</constraint-mapping>
+</validation-config>
\ No newline at end of file

Propchange: openjpa/trunk/openjpa-integration/validation/src/test/resources/META-INF/validation.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openjpa/trunk/openjpa-integration/validation/src/test/resources/org/apache/openjpa/integration/validation/constraints.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-integration/validation/src/test/resources/org/apache/openjpa/integration/validation/constraints.xml?rev=802062&view=auto
==============================================================================
--- openjpa/trunk/openjpa-integration/validation/src/test/resources/org/apache/openjpa/integration/validation/constraints.xml
(added)
+++ openjpa/trunk/openjpa-integration/validation/src/test/resources/org/apache/openjpa/integration/validation/constraints.xml
Fri Aug  7 16:06:17 2009
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<constraint-mappings
+        xmlns="http://jboss.org/xml/ns/javax/validation/mapping"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation=
+            "http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd">
+    <default-package>org.apache.openjpa.integration.validation</default-package>
+    <bean class="XMLSuper" ignore-annotations="false">
+        <getter name="superStrValue">
+        <valid/>
+            <constraint annotation="javax.validation.constraints.NotNull"/>
+        </getter>
+    </bean>
+    <bean class="XMLBase" ignore-annotations="false">
+        <getter name="strValue">
+        <valid/>
+            <constraint annotation="javax.validation.constraints.NotNull"/>
+        </getter>
+    </bean>
+</constraint-mappings>
\ No newline at end of file

Propchange: openjpa/trunk/openjpa-integration/validation/src/test/resources/org/apache/openjpa/integration/validation/constraints.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: openjpa/trunk/openjpa-integration/validation/src/test/resources/org/apache/openjpa/integration/validation/persistence.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-integration/validation/src/test/resources/org/apache/openjpa/integration/validation/persistence.xml?rev=802062&r1=802061&r2=802062&view=diff
==============================================================================
--- openjpa/trunk/openjpa-integration/validation/src/test/resources/org/apache/openjpa/integration/validation/persistence.xml
(original)
+++ openjpa/trunk/openjpa-integration/validation/src/test/resources/org/apache/openjpa/integration/validation/persistence.xml
Fri Aug  7 16:06:17 2009
@@ -143,4 +143,17 @@
         </properties>
     </persistence-unit>
     
+    <persistence-unit name="XMLConstraintPU">
+        <description>Make sure the mapping file and class listings match the same PU
+         in META-INF/ehn-persistence.xml</description>
+        <mapping-file>org/apache/openjpa/integration/validation/validation-orm.xml</mapping-file>
+        <class>org.apache.openjpa.integration.validation.XMLBase</class>
+        <class>org.apache.openjpa.integration.validation.XMLSuper</class>
+        <validation-mode>AUTO</validation-mode>
+        <properties>
+            <property name="openjpa.jdbc.SynchronizeMappings" 
+                value="buildSchema"/>
+        </properties>
+    </persistence-unit>
+    
 </persistence>

Added: openjpa/trunk/openjpa-integration/validation/src/test/resources/org/apache/openjpa/integration/validation/validation-orm.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-integration/validation/src/test/resources/org/apache/openjpa/integration/validation/validation-orm.xml?rev=802062&view=auto
==============================================================================
--- openjpa/trunk/openjpa-integration/validation/src/test/resources/org/apache/openjpa/integration/validation/validation-orm.xml
(added)
+++ openjpa/trunk/openjpa-integration/validation/src/test/resources/org/apache/openjpa/integration/validation/validation-orm.xml
Fri Aug  7 16:06:17 2009
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_2_0.xsd"
+    version="2.0">
+    <mapped-superclass
+        class=
+        "org.apache.openjpa.integration.validation.XMLSuper"
+        access="PROPERTY">
+        <attributes>
+            <basic name="superStrValue"/>
+        </attributes>
+    </mapped-superclass>
+    <entity name="XMLBase" 
+            class="org.apache.openjpa.integration.validation.XMLBase" 
+            access="PROPERTY">
+        <attributes>
+            <id name="id">
+                <generated-value/>
+            </id>
+            <basic name="strValue"/>
+        </attributes>
+    </entity>    
+</entity-mappings>

Propchange: openjpa/trunk/openjpa-integration/validation/src/test/resources/org/apache/openjpa/integration/validation/validation-orm.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/validation/ValidatorImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/validation/ValidatorImpl.java?rev=802062&r1=802061&r2=802062&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/validation/ValidatorImpl.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/validation/ValidatorImpl.java
Fri Aug  7 16:06:17 2009
@@ -33,6 +33,7 @@
 import org.apache.openjpa.conf.OpenJPAConfiguration;
 import org.apache.openjpa.event.LifecycleEvent;
 import org.apache.openjpa.lib.conf.Configuration;
+import org.apache.openjpa.lib.log.Log;
 import org.apache.openjpa.lib.util.J2DoPrivHelper;
 import org.apache.openjpa.lib.util.Localizer;
 import org.apache.openjpa.validation.AbstractValidator;
@@ -47,7 +48,7 @@
     private Validator _validator = null;
     private ValidationMode _mode = ValidationMode.AUTO;
     private OpenJPAConfiguration _conf = null;
-
+    private transient Log _log = null;
     
     // A map storing the validation groups to use for a particular event type
     private Map<Integer, Class<?>[]> _validationGroups = 
@@ -85,6 +86,7 @@
     public ValidatorImpl(Configuration conf) {
         if (conf instanceof OpenJPAConfiguration) {
             _conf = (OpenJPAConfiguration)conf;
+            _log = _conf.getLog(OpenJPAConfiguration.LOG_RUNTIME);
             Object validatorFactory = _conf.getValidationFactoryInstance();
             String mode = _conf.getValidationMode();
             _mode = Enum.valueOf(ValidationMode.class, mode);
@@ -391,7 +393,8 @@
         try {
             factory = AccessController.doPrivileged(J2DoPrivHelper.buildDefaultValidatorFactoryAction());
         } catch (javax.validation.ValidationException e) {
-            // no validation providers found
+            if (_log != null && _log.isTraceEnabled())
+                _log.trace(_loc.get("factory-create-failed"), e);
         }
         return factory;
     }

Modified: openjpa/trunk/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/validation/localizer.properties
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/validation/localizer.properties?rev=802062&r1=802061&r2=802062&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/validation/localizer.properties
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/validation/localizer.properties
Fri Aug  7 16:06:17 2009
@@ -36,3 +36,5 @@
     value "{2}" of property "{1}" in class "{0}".
 invalid-validation-group: The class "{0}" specified in the validation group \
 	property "{1}" is not valid or could not be loaded. 
+factory-create-failed: Could not create default validator factory.  \
+	Exception:



Mime
View raw message