[hibernate-dev] No ValidatorFactory exposed through "javax.persistence.validation.factory" in WF 10 CR1

Steve Ebersole steve at hibernate.org
Wed Sep 23 10:36:05 EDT 2015


Its really a different discussion Hardy.  The discussion here is
whether EntityManagerFactory().getProperties() should return values that
were not passed in the Map when building the EntityManagerFactory.

Yes the spec says that ValidatorFactory should be passed as part of the
"configuration Map" when building the EMF.  However, WF does not do it that
way.  Hibernate supports passing the ValidatorFactory in as part of the
"configuration Map", but it also supports this proprietary 2-phase approach
developed for WF.

All that said, there are other cases where we explicitly handle certain
settings to be returned from EntityManagerFactory().getProperties().
Things like Connection info defined in the persistence.xml we explicitly
transfer into the Map backing EntityManagerFactory().getProperties().  So
the question is whether a similar thing makes sense for ValidatorFactory.



On Wed, Sep 23, 2015 at 8:54 AM Hardy Ferentschik <hardy at hibernate.org>
wrote:

> > Yes, EntityManagerFactoryBuilder#withValidatorFactory() is called (see
> >
> https://github.com/wildfly/wildfly/blob/10.0.0.CR1/jpa/subsystem/src/main/java/org/jboss/as/jpa/service/PersistenceUnitServiceImpl.java#L150
> ,
> > I see it actually happening in the debugger), so I suppose Hibernate
> > ORM has the VF at its hands correctly.
> >
> > Only that it is not exposed via the
> > "javax.persistence.validation.factory" key via the EMF-exposed
> > property map any more. So the call to
> >
> >     entityManagerFactory().getProperties().get(
> > "javax.persistence.validation.factory" );
> >
> > returns null whereas it used to return the VF in earlier versions.
>
> I think this is related to this discussion -
> http://lists.jboss.org/pipermail/hibernate-dev/2015-July/013027.html
> and HHH-9905. The map value is indeed not passed along anymore.
>
> > But reading the spec again, it seems it only describes the
> > "javax.persistence.validation.factory" key as means of passing the VF
> > *to* JPA but not as means of obtaining it. Apparently that's just
> > something that happened to be the case in WF before, comments at the
> > test even states that this behaviour is not portable across
> > containers.
>
> I guess you are referring to JPA specs section 3.6.2 Providing the
> ValidatorFactory.
> There it is quite clear that the map passed should be used to pass the
> instance
> to the JPA provider. I guess as you suggest the question is whether
> a later call to 'entityManager.getEntityManagerFactory().getProperties()'
> is required
> to expose the same properties as the ones passed to the factory creation.
> Somehow, I would expect so, but I guess that is not explicitly expressed.
>
> > So I suppose I'll have to rework that test in the course of the upgrade.
>
> I guess that' the way to go.
>
> --Hardy
>
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev


More information about the hibernate-dev mailing list