[jboss-cvs] JBossAS SVN: r95522 - in projects/jpa/trunk/impl/src/main/java/org/jboss/jpa/impl: beanvalidation and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Oct 23 14:41:50 EDT 2009
Author: epbernard
Date: 2009-10-23 14:41:49 -0400 (Fri, 23 Oct 2009)
New Revision: 95522
Added:
projects/jpa/trunk/impl/src/main/java/org/jboss/jpa/impl/beanvalidation/
projects/jpa/trunk/impl/src/main/java/org/jboss/jpa/impl/beanvalidation/ValidatorFactoryProvider.java
Modified:
projects/jpa/trunk/impl/src/main/java/org/jboss/jpa/impl/remote/RemotelyInjectEntityManagerFactory.java
Log:
JBJPA-15 add more support for Bean Validation
Added: projects/jpa/trunk/impl/src/main/java/org/jboss/jpa/impl/beanvalidation/ValidatorFactoryProvider.java
===================================================================
--- projects/jpa/trunk/impl/src/main/java/org/jboss/jpa/impl/beanvalidation/ValidatorFactoryProvider.java (rev 0)
+++ projects/jpa/trunk/impl/src/main/java/org/jboss/jpa/impl/beanvalidation/ValidatorFactoryProvider.java 2009-10-23 18:41:49 UTC (rev 95522)
@@ -0,0 +1,18 @@
+package org.jboss.jpa.impl.beanvalidation;
+
+import javax.validation.Validation;
+import javax.validation.ValidatorFactory;
+
+/**
+ * Return the appropriate ValidatorFactory
+ * The current implementation create a new one each time: FIX IT ;)
+ *
+ * @author Emmanuel Bernard
+ */
+public class ValidatorFactoryProvider
+{
+ public ValidatorFactory getValidatorFactory() {
+ //FIXME get it from JNDI or the deployer
+ return Validation.buildDefaultValidatorFactory();
+ }
+}
Modified: projects/jpa/trunk/impl/src/main/java/org/jboss/jpa/impl/remote/RemotelyInjectEntityManagerFactory.java
===================================================================
--- projects/jpa/trunk/impl/src/main/java/org/jboss/jpa/impl/remote/RemotelyInjectEntityManagerFactory.java 2009-10-23 18:36:56 UTC (rev 95521)
+++ projects/jpa/trunk/impl/src/main/java/org/jboss/jpa/impl/remote/RemotelyInjectEntityManagerFactory.java 2009-10-23 18:41:49 UTC (rev 95522)
@@ -43,6 +43,7 @@
import org.hibernate.ejb.HibernatePersistence;
import org.jboss.jpa.impl.AbstractEntityManagerFactoryDelegator;
import org.jboss.jpa.impl.JPAConstants;
+import org.jboss.jpa.impl.beanvalidation.ValidatorFactoryProvider;
import org.jboss.jpa.impl.deployment.PersistenceUnitInfoImpl;
import org.jboss.logging.Logger;
import org.jboss.metadata.jpa.spec.PersistenceUnitMetaData;
@@ -116,14 +117,9 @@
PersistenceProvider pp = (PersistenceProvider) providerClass.newInstance();
Map<Object, Object> properties = new HashMap<Object, Object>(1);
- properties.put( JPAConstants.BEAN_VALIDATION_FACTORY, getValidatorFactory() );
+ properties.put( JPAConstants.BEAN_VALIDATION_FACTORY, new ValidatorFactoryProvider().getValidatorFactory() );
actualFactory = pp.createContainerEntityManagerFactory(pi, properties);
}
-
- private ValidatorFactory getValidatorFactory() {
- //FIXME get it from JNDI or the deployer
- return Validation.buildDefaultValidatorFactory();
- }
@Override
protected EntityManagerFactory getDelegate()
More information about the jboss-cvs-commits
mailing list