[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 13:30:00 EDT 2018


What's being returned instead of the fallback?  Is that configured
somewhere for Hibernate to use that?  Like a testing hibernate.properties?

On Fri, Sep 21, 2018 at 12:03 PM Scott Marlow <smarlow at redhat.com> wrote:

>
>
> On 9/21/18 10:29 AM, Steve Ebersole wrote:
> > 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
>
> Thanks, this helps!
>
> I pushed updates to
> https://github.com/scottmarlow/hibernate-orm/commits/ServiceContributorTest
> and squashed my commits.
>
> The good news is that MyRegionFactoryInitiator#resolveRegionFactory +
> MyRegionFactoryInitiator#contribute are being called.  :)
>
> I'm not sure why MyRegionFactoryInitiator#fallback doesn't get called.
>
> I commented out the RegionFactory lookup/testing, to resolve compile
> errors.
>
> >
> >
> > [1] https://gist.github.com/scottmarlow/63241549820243923aab16e664c3c6c3
> >
>


More information about the hibernate-dev mailing list