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

2018-09-21 Thread Steve Ebersole
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  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
> >
>
___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev


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

2018-09-21 Thread Scott Marlow


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
> 
___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev

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

2018-09-21 Thread Steve Ebersole
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  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
>
___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev


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

2018-09-21 Thread Scott Marlow
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
___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev


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

2018-09-20 Thread Scott Marlow

On 9/20/18 3:17 PM, Scott Marlow wrote:
> I'm going to try some more changes on the WF side, to see if I can work 
> around this problem.  I'll report back on how that goes. :)

I tried overriding the ServiceRegistryImplementor#initiateService(Map 
configurationValues, ServiceRegistryImplementor registry) + 
getFallback(Map configurationValues, ServiceRegistryImplementor 
registry) methods to check if perhaps those get called for all 
persistence units, but no.  So, we still need to create a reproducer for 
Hibernate ORM.

> 
> On 9/20/18 12:05 PM, Scott Marlow wrote:
>> Is 
>> https://gist.github.com/scottmarlow/63241549820243923aab16e664c3c6c3 
>> closer to what we need?
>>
>> On 9/19/18 3:47 PM, Steve Ebersole wrote:
>>> StandardServiceRegistry`No, it's not.
>>>
>>> Each call to `registry.getService( RegionFactory.class )` in your 
>>> test returns the same `RegionFactory` - by design.
>>>
>>> By default each SF bootstrap uses a unique StandardServiceRegistry 
>>> which is what the ServiceContributor contributes services to.  In 
>>> terms of your test, it would be like creating a second 
>>> `StandardServiceRegistry` and asking that for the second RegionFactory
>>>
>>>
>>>
>>> On Wed, Sep 19, 2018 at 11:12 AM Scott Marlow >> > wrote:
>>>
>>>     Please look at
>>> https://github.com/scottmarlow/hibernate-orm/tree/ServiceContributorTest
>>>
>>>     and let me know if this is a valid test.  I added a test that calls
>>>     registry.getService( RegionFactory.class ) twice and fails if the
>>>     RegionFactoryInitiator doesn't get called twice.
>>>
>>>     Is that the same as creating two separate SFs and expecting the
>>>     RegionFactoryInitiator to be called twice?
>>>
>>>
>>>     On 9/19/18 9:52 AM, Scott Marlow wrote:
>>>  >
>>>  >
>>>  > On 9/19/18 9:22 AM, Steve Ebersole wrote:
>>>  >> 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?
>>>  >
>>>  > Yes, I will work on a test.
>>>  >
>>>  >>
>>>  >>
>>>  >> On Wed, Sep 19, 2018, 8:12 AM Scott Marlow >>     
>>>  >> >> 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
>>>  >>  > mailto:smar...@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
>>>  >>     mailto:smar...@redhat.com>
>>>     >
>>>  

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

2018-09-20 Thread Scott Marlow
I'm going to try some more changes on the WF side, to see if I can work 
around this problem.  I'll report back on how that goes. :)

On 9/20/18 12:05 PM, Scott Marlow wrote:
> Is https://gist.github.com/scottmarlow/63241549820243923aab16e664c3c6c3 
> closer to what we need?
> 
> On 9/19/18 3:47 PM, Steve Ebersole wrote:
>> StandardServiceRegistry`No, it's not.
>>
>> Each call to `registry.getService( RegionFactory.class )` in your test 
>> returns the same `RegionFactory` - by design.
>>
>> By default each SF bootstrap uses a unique StandardServiceRegistry 
>> which is what the ServiceContributor contributes services to.  In 
>> terms of your test, it would be like creating a second 
>> `StandardServiceRegistry` and asking that for the second RegionFactory
>>
>>
>>
>> On Wed, Sep 19, 2018 at 11:12 AM Scott Marlow > > wrote:
>>
>>     Please look at
>> 
>> https://github.com/scottmarlow/hibernate-orm/tree/ServiceContributorTest
>>
>>     and let me know if this is a valid test.  I added a test that calls
>>     registry.getService( RegionFactory.class ) twice and fails if the
>>     RegionFactoryInitiator doesn't get called twice.
>>
>>     Is that the same as creating two separate SFs and expecting the
>>     RegionFactoryInitiator to be called twice?
>>
>>
>>     On 9/19/18 9:52 AM, Scott Marlow wrote:
>>  >
>>  >
>>  > On 9/19/18 9:22 AM, Steve Ebersole wrote:
>>  >> 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?
>>  >
>>  > Yes, I will work on a test.
>>  >
>>  >>
>>  >>
>>  >> On Wed, Sep 19, 2018, 8:12 AM Scott Marlow >     
>>  >> >> 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
>>  >>  > mailto:smar...@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
>>  >>     mailto:smar...@redhat.com>
>>     >
>>  >>  > 
>>     >>
>>  >>  >  > > >      >     >
>>  >>     
>>      wrote:
>>  >>  >  > >
>>  >>  >  > >     I'm deploying an application 

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

2018-09-19 Thread Steve Ebersole
StandardServiceRegistry`No, it's not.

Each call to `registry.getService( RegionFactory.class )` in your test
returns the same `RegionFactory` - by design.

By default each SF bootstrap uses a unique StandardServiceRegistry which is
what the ServiceContributor contributes services to.  In terms of your
test, it would be like creating a second `StandardServiceRegistry` and
asking that for the second RegionFactory



On Wed, Sep 19, 2018 at 11:12 AM Scott Marlow  wrote:

> Please look at
> https://github.com/scottmarlow/hibernate-orm/tree/ServiceContributorTest
> and let me know if this is a valid test.  I added a test that calls
> registry.getService( RegionFactory.class ) twice and fails if the
> RegionFactoryInitiator doesn't get called twice.
>
> Is that the same as creating two separate SFs and expecting the
> RegionFactoryInitiator to be called twice?
>
>
> On 9/19/18 9:52 AM, Scott Marlow wrote:
> >
> >
> > On 9/19/18 9:22 AM, Steve Ebersole wrote:
> >> 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?
> >
> > Yes, I will work on a test.
> >
> >>
> >>
> >> On Wed, Sep 19, 2018, 8:12 AM Scott Marlow  >> > 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
> >>  > mailto:smar...@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
> >> mailto:smar...@redhat.com>
> >>  > >
> >>  >  > > 
> >>  >>  >  > >
> >>  >  > > 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@lists.jboss.org
> >> 
> >>  >  >> >
> >>  >  >> 
> >>  >  >> >>
> >>  >  > > https://lists.jboss.org/mailman/listinfo/hibernate-dev
> >>  >  > >
> >>  >  > 

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

2018-09-19 Thread Scott Marlow
Please look at 
https://github.com/scottmarlow/hibernate-orm/tree/ServiceContributorTest 
and let me know if this is a valid test.  I added a test that calls 
registry.getService( RegionFactory.class ) twice and fails if the 
RegionFactoryInitiator doesn't get called twice.

Is that the same as creating two separate SFs and expecting the 
RegionFactoryInitiator to be called twice?


On 9/19/18 9:52 AM, Scott Marlow wrote:
> 
> 
> On 9/19/18 9:22 AM, Steve Ebersole wrote:
>> 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?
> 
> Yes, I will work on a test.
> 
>>
>>
>> On Wed, Sep 19, 2018, 8:12 AM Scott Marlow > > 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
>>  > mailto:smar...@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
>>     mailto:smar...@redhat.com>
>>  > >
>>  >  > > 
>>     >  >  > >
>>  >  > >     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@lists.jboss.org
>>     
>>  > >     >
>>  > >     
>>  > >     >>
>>  >  > > https://lists.jboss.org/mailman/listinfo/hibernate-dev
>>  >  > >
>>  >  > ___
>>  >  > hibernate-dev mailing list
>>  >  > hibernate-dev@lists.jboss.org
>>     
>>     >     >
>>  >  > https://lists.jboss.org/mailman/listinfo/hibernate-dev
>>
___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev

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

2018-09-19 Thread Scott Marlow


On 9/19/18 9:22 AM, Steve Ebersole wrote:
> 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?

Yes, I will work on a test.

> 
> 
> On Wed, Sep 19, 2018, 8:12 AM Scott Marlow  > 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
>  > mailto:smar...@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
> mailto:smar...@redhat.com>
>  > >
>  >  > > 
>   >  > >
>  >  > >     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@lists.jboss.org
> 
>  >  >
>  >  
>  >  >>
>  >  > > https://lists.jboss.org/mailman/listinfo/hibernate-dev
>  >  > >
>  >  > ___
>  >  > hibernate-dev mailing list
>  >  > hibernate-dev@lists.jboss.org
> 
>  >
>  >  > https://lists.jboss.org/mailman/listinfo/hibernate-dev
> 
___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev

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

2018-09-19 Thread Steve Ebersole
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  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
> > mailto:smar...@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  > 
> >  > > >> 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@lists.jboss.org
> > 
> >  > >
> >  > > https://lists.jboss.org/mailman/listinfo/hibernate-dev
> >  > >
> >  > ___
> >  > hibernate-dev mailing list
> >  > hibernate-dev@lists.jboss.org 
> >  > https://lists.jboss.org/mailman/listinfo/hibernate-dev
>
___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev


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

2018-09-19 Thread Scott Marlow


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 
> mailto:smar...@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  
>  > > >> 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@lists.jboss.org 
>  
>  >
>  > > https://lists.jboss.org/mailman/listinfo/hibernate-dev
>  > >
>  > ___
>  > hibernate-dev mailing list
>  > hibernate-dev@lists.jboss.org 
>  > https://lists.jboss.org/mailman/listinfo/hibernate-dev
___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev

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

2018-09-19 Thread Gunnar Morling
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.

--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 :
>
>
> 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  > > 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@lists.jboss.org 
> > https://lists.jboss.org/mailman/listinfo/hibernate-dev
> >
> ___
> hibernate-dev mailing list
> hibernate-dev@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev


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

2018-09-18 Thread Scott Marlow


On 9/14/18 6:15 PM, Steve Ebersole wrote:
> Another thought.  If you are specifically talking about JPA container 
> integration we could always accept ServiceContributor(s) via the 
> integration values Map.

This is for both JPA container integration and not container integration.

> 
> On Fri, Sep 14, 2018 at 10: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
> 
> On Fri, Sep 14, 2018 at 9:27 PM Scott Marlow  > 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@lists.jboss.org 
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
> 
___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev

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

2018-09-18 Thread Scott Marlow

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  > 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@lists.jboss.org 
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
> 
___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev

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

2018-09-14 Thread Steve Ebersole
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

On Fri, Sep 14, 2018 at 9:27 PM Scott Marlow  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@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>
___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev


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

2018-09-14 Thread Steve Ebersole
Another thought.  If you are specifically talking about JPA container
integration we could always accept ServiceContributor(s) via the
integration values Map.

On Fri, Sep 14, 2018 at 10: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
>
> On Fri, Sep 14, 2018 at 9:27 PM Scott Marlow  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@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>>
>
___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev