[wildfly-dev] How to deal with resource refs when deploying JPA container managed entity managers (WFLY-2841)

Eduardo Martins emartins at redhat.com
Fri Jan 31 12:47:07 EST 2014


It works when the MSC binder service’s ManagedReferenceFactory has the datasource, but it won’t work for external contexts (jndi federation) or link refs (which we don’t officially support). We should fix that by replacing the bind service dependency, with an injection using a LookupInjectionSource.

—E

On 31 Jan 2014, at 17:34, Jason Greene <jason.greene at redhat.com> wrote:

> Ah yes it does use ManagedReferenceFactory so is reliable, I just misinterpreted the earlier conversation about there being a hard dep on the data source.
> 
> On Jan 31, 2014, at 11:03 AM, Martin Andersson <martin.andersson at purplescout.se> wrote:
> 
>> Thanks for your input!
>> 
>> The alias and global naming does actually work!
>> 
>> Br,
>> Martin Andersson
>> Java EE developer at www.purplescout.se
>> 
>> 
>> 
>> On Fri, Jan 31, 2014 at 5:56 PM, Jason Greene <jason.greene at redhat.com> wrote:
>> 
>> On Jan 31, 2014, at 10:39 AM, Jason Greene <jason.greene at redhat.com> wrote:
>> 
>>> 
>>> On Jan 31, 2014, at 8:33 AM, Martin Andersson <martin.andersson at purplescout.se> wrote:
>>> 
>>>> I agree. I don't think mapping a datasource in jboss-web.xml is such an exotic use case. I should just work.
>>> 
>>> It’s not, it’s actually implied by the standard, as you can define them in web.xml as well. It’s a lifecycle problem we need to solve.
>>> 
>>>> Also, there is no hint anywere that there is a property you can set to make it work.
>>>> 
>>>> The proprietary jboss namespace is not an option since I want to be vendor neutral, but ear/java:app is definitely an option.
>>> 
>>> Another solution specific to EE7 is you can leave the jta-data-source undefined in persistence.xml which will use the platforms default data source. We allow you to point that anywhere. However, that limits you to one, so not really a complete solution.
>>> 
>>> A more complete solution is to use a common global name, and define an alias to your deployment in our naming subsystem like so:
>>> 
>>> <bindings>
>>>  <lookup name="java:global/env/FooDS" lookup="java:jboss/datasources/ExampleDS"/>
>>> </bindings>
>>> 
>> 
>> Actually don’t waste your time on this alias option. PeristenceUnitServiceHandler’s approach to names will prevent it from working.
>> 
>>>> 
>> Jason T. Greene
>> WildFly Lead / JBoss EAP Platform Architect
>> JBoss, a division of Red Hat
>> 
>> 
>> 
>> 
>> -- 
>> Hälsningar,
>> Martin Andersson
>> Purple Scout AB
>> +46 732 05 14 01
> 
> --
> Jason T. Greene
> WildFly Lead / JBoss EAP Platform Architect
> JBoss, a division of Red Hat
> 
> 
> _______________________________________________
> wildfly-dev mailing list
> wildfly-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/wildfly-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/wildfly-dev/attachments/20140131/ec6461a9/attachment.html 


More information about the wildfly-dev mailing list