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

Jason Greene jason.greene at redhat.com
Fri Jan 31 11:56:27 EST 2014


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




More information about the wildfly-dev mailing list