users@glassfish.java.net

Re: CDI broken between EJB and JPA modules

From: <glassfish_at_javadesktop.org>
Date: Thu, 08 Apr 2010 12:17:34 PDT

Sahoo,

You rock! : ) You hit the nail on the head. As soon as I added a duplicate @PersistenceContext to my EJB, the @PersistenceContext in my DaoImpl started working.

I'm disappointed that I didn't think to try that myself. I think I've been staring at this stuff too long. : ) I'll go ahead and open a GF bug for this issue.

One other question for you:

> The ear you have attached has separate jar with JPA
> classes and EJB
> classes. I don't think that would work. So, first you
> need to merge
> JPA.jar with EJB.jar.

Why is that? I've read in so many different places how it's recommended to put JPA entities (along with Repository or Dao interfaces) into their own separate module, especially if multiple other modules (WAR, EJB, etc.) will need to use those entities. Why does CDI not support this recommended packaging structure?

Thanks,
-Dan
[Message sent by forum member 'theodan']

http://forums.java.net/jive/thread.jspa?messageID=395993