[hibernate-dev] Is there a way to have ServiceContributor per SessionFactory/EMF instead of per application classloader?

Steve Ebersole steve at hibernate.org
Fri Sep 21 10:29:52 EDT 2018


Honestly Scott, I am thoroughly confused now as to what you are wanting and
what you are reporting.

Your last code fragment[1] is close.  As I said earlier, building a
SessionFactory typically involves individual service registries being used
for each SF.  You have to go out of your way for that to not be the case.
I am pretty sure WF does not do this "going out of its way".  So not sure
why the test does.  To me either:

1. write a unit test for StandardServiceRegistry(/Builder)
2. write a functional test for how building a SessionFactory handles
StandardServiceRegistry.

Instead you kind of do both and therefor do neither.

I created a fork of your gist that shows a better test using (2), which I
think is more what you are wondering about.  It is "better" imo because I
*think* it better represents what you do in WF/Jipijapa -
https://gist.github.com/sebersole/d93a28b1dcf16f6f7eb823b7341a9097


[1] https://gist.github.com/scottmarlow/63241549820243923aab16e664c3c6c3


On Fri, Sep 21, 2018 at 9:05 AM Scott Marlow <smarlow at redhat.com> wrote:

> I verified that SessionFactoryServiceContributor doesn't help WF either,
> as we see the same problem.
>
> I did hack together a unit test under ORM (using the WF integration
> testing) that shows that we don't see the same problem when the
> https://github.com/hibernate/hibernate-orm/tree/master/hibernate-jipijapa
> integration classes are used.
>
> It seems likely that something is wrong with the
>
> https://github.com/wildfly/wildfly/tree/master/jpa/hibernate5_3/src/main/java/org/jboss/as/jpa/hibernate5
> classes, that causes the problem that I am seeing.
>
> Scott
>


More information about the hibernate-dev mailing list