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

Steve Ebersole steve at hibernate.org
Wed Sep 19 09:22:45 EDT 2018


Ohhh... Sorry I misunderstood.  I thought you were asking about ways to
have the contributor only apply to one of the PUs...

I'm surprised it isn't applied to each actually.  I'd consider that a bug.
Can you put together a test?


On Wed, Sep 19, 2018, 8:12 AM Scott Marlow <smarlow at redhat.com> wrote:

>
>
> On 9/19/18 5:41 AM, Gunnar Morling wrote:
> > Would SessionFactoryServiceContributor [1] be of use to you? It lets you
> > add services to the SF-scoped service registry; not sure whether that
> > suits your requirements or no.
>
> Thanks, I will give that a try.  We currently use RegionFactoryInitiator
> and update the configuration settings passed via
> RegionFactoryInitiator#resolveRegionFactory(Map configurationValues,
> ServiceRegistryImplementor).  I wonder if that is possible with
> SessionFactoryServiceContributor?
>
> >
> > --Gunnar
> >
> > [1]
> >
> https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/main/java/org/hibernate/service/spi/SessionFactoryServiceContributor.java
> >
> > Am Di., 18. Sep. 2018 um 21:00 Uhr schrieb Scott Marlow
> > <smarlow at redhat.com <mailto:smarlow at redhat.com>>:
> >  >
> >  >
> >  > On 9/14/18 6:14 PM, Steve Ebersole wrote:
> >  > > Doing so would require a programatic call while bootstrapping
> >  > > Hibernate.  The ServiceContributors are applied during
> >  > > `org.hibernate.boot.registry.StandardServiceRegistryBuilder#build`
> >  > > processing.  So we'd need a call to register a ServiceContributor
> with
> >  > > the StandardServiceRegistryBuilder.
> >  > >
> >  > > Of course that also means you'd have to have access to the
> >  > > StandardServiceRegistryBuilder
> >  >
> >  > I don't have a way to add a programatic call while bootstrapping "not
> >  > JPA container".
> >  >
> >  > >
> >  > > On Fri, Sep 14, 2018 at 9:27 PM Scott Marlow <smarlow at redhat.com
> > <mailto:smarlow at redhat.com>
> >  > > <mailto:smarlow at redhat.com <mailto:smarlow at redhat.com>>> wrote:
> >  > >
> >  > >     I'm deploying an application with two persistence units
> > however, the
> >  > >     ServiceContributor contribute(StandardServiceRegistryBuilder)
> > [1] is
> >  > >     only being called once, instead of per SessionFactory/EMF (or
> so it
> >  > >     seems).
> >  > >
> >  > >     Is there a way to have the
> >  > >     contribute(StandardServiceRegistryBuilder) be
> >  > >     called per SessionFactory/EMF instead?
> >  > >
> >  > >     Scott
> >  > >
> >  > >     [1]
> >  > >
> >
> https://github.com/wildfly/wildfly/blob/master/jpa/hibernate5_3/src/main/java/org/jboss/as/jpa/hibernate5/service/ServiceContributorImpl.java#L28
> >  > >     _______________________________________________
> >  > >     hibernate-dev mailing list
> >  > > hibernate-dev at lists.jboss.org
> > <mailto:hibernate-dev at lists.jboss.org>
> > <mailto:hibernate-dev at lists.jboss.org
> > <mailto:hibernate-dev at lists.jboss.org>>
> >  > > https://lists.jboss.org/mailman/listinfo/hibernate-dev
> >  > >
> >  > _______________________________________________
> >  > hibernate-dev mailing list
> >  > hibernate-dev at lists.jboss.org <mailto:hibernate-dev at lists.jboss.org>
> >  > https://lists.jboss.org/mailman/listinfo/hibernate-dev
>


More information about the hibernate-dev mailing list