[jpa-spec users] Re: Integration with CDI

From: Linda DeMichiel <>
Date: Wed, 13 Jul 2011 12:51:38 -0700

Hi Craig,

Thanks for the feedback. I do apologize for having let your previous email
sent to me lapse. Unfortunately it got buried hundreds of emails deep in my

Actually, one of the things I have been discussing behind the scenes is
how we might support CDI injection into entity listeners. In the meantime,
if you or Adam have a concrete proposal that you would like to make,
that is of course welcome. As you may have noticed, however, the group
as a whole is not currently supportive of injection into JPA entities.
If that changes, it could also be considered further.

With regard to the datasource mapping item you mention (as well as the
GlassFish issue you filed) -- that has triggered some interesting
internal discussion here. We think your point is valid, and I will add
this item to the queue for consideration for JPA 2.1.



On 7/13/2011 1:57 AM, Craig Ringer wrote:
> Dear Linda Demichiel,
> I contacted you a few weeks ago to find out about any plans the JPA 2.1 spec team had about specifying integration with
> CDI, because it's a real sore-point in development of EE 6 apps at present.
> I thought I'd follow up and see what you thought, as I haven't heard back from you or seen any further discussion on the
> -experts mailing list after Adam Bien reposted my message to him on that list.
> I'm really concerned that JPA 2.1 might come out without any kind of CDI integration, and it's such a big usability
> issue on any kind of DI-based app (ie: any standard Java EE 6 app using EJB 3.1 or plain CDI) that it'd be a big shame.
> If there's any way I can help with this I'd be happy to, though I don't feel particularly well qualified when it comes
> to the details.
> More recently I've noticed another interesting hiccup. According to the Glassfish folks, JTA datasource names in
> persistence.xml must be looked up only in the container global JNDI context, not the component/module context. That
> means datasources for persistence.xml cannot be mapped using a web.xml resource-ref and a glassfish-web.xml or
> jboss-web.xml resource-ref mapping. This seems like an ... interesting ... quirk, given that resources are mapped in
> almost all other contexts and _need_ to be mappable for inter-container portability. Is there any chance JPA 2.1 could
> specify that persistence contexts be initialized within module context, applying any mappings defined for that context?
> --
> Craig Ringer
> POST Newspapers
> 276 Onslow Rd, Shenton Park
> Ph: 08 9381 3088 Fax: 08 9388 2258
> ABN: 50 008 917 717