Skip to main content

[jpa-spec users] Re: Integration with CDI

  • From: Craig Ringer <craig@...>
  • To: Linda DeMichiel <linda.demichiel@...>
  • Cc: users@..., Adam Bien <abien@...>
  • Subject: [jpa-spec users] Re: Integration with CDI
  • Date: Thu, 14 Jul 2011 09:51:26 +0800

Linda,

I realize you're busy and juggling a lot of things, so don't worry about letting my mail get lost in the noise. Thanks for taking the time to reply now.

It sounds like it might be necessary to bash together a couple of example apps to show why injection into entity listeners is necessary (showing how problematic the BeanManager access hacks currently required are), along with a more definite proposal for how this might work. I'll see if I can interest anybody in collaborating on that.

Personally, I think injection into JPA entities themselves is a marginal idea at best; if anything I think a warning should be emitted if @Inject is found in an @Entity. It's entity listeners where I think injection support and lifecycle annotations are vital.

I'll work on bashing out a demo and description. Time and other committments permitting I might even be able to have a look at how hard it'd be to retrofit support into EclipseLink as a proof of concept.

I'm glad to hear the DS mapping issue got some attention. It's one of those interesting little holes in the spec that I'm always tripping over, making Java EE 6 usability and productivity far from what it could be. I keep a list here:

http://blog.ringerc.id.au/2011/07/java-ee-6-traps-pitfalls-and-warts-list.html



On 14/07/2011 3:51 AM, Linda DeMichiel wrote:
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
inbox.

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.

regards,

-Linda


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
http://www.postnewspapers.com.au/


POST Newspapers
276 Onslow Rd, Shenton Park
Ph: 08 9381 3088     Fax: 08 9388 2258
ABN: 50 008 917 717
http://www.postnewspapers.com.au/


[jpa-spec users] Integration with CDI

Craig Ringer 07/13/2011

[jpa-spec users] Re: Integration with CDI

Linda DeMichiel 07/13/2011

[jpa-spec users] Re: Integration with CDI

Craig Ringer 07/14/2011

[jpa-spec users] Re: Integration with CDI

Linda DeMichiel 07/14/2011

[jpa-spec users] Re: Integration with CDI

Adam Bien 07/15/2011
 
 
Close
loading
Please Confirm
Close