users@glassfish.java.net

Re: CDI broken between EJB and JPA modules

From: Witold Szczerba <pljosh.mail_at_gmail.com>
Date: Thu, 8 Apr 2010 23:25:42 +0200

2010/4/8 Sahoo <Sahoo_at_sun.com>:
> Don't call JPA.jar a module. There are only four module types in Java EE:
> ejb, web, appclient and rar. JPA.jar is a library jar, so if you place it in
> lib directory of ear file, things should work as well.
>
> Sahoo

Hi again,
you are correct, a JAR file with persistence unit is not a "module" if
you define "module" as Java EE artifact.
The other thing is, once I had one EJB module with JPA defined inside
and I could not manage to separate it. I did it as documentation says:
simple JAR, jpa-entities.jar for example, with
META-INF/persistence.xml placed in EAR/lib - it does not work, at
least in Glassfish v2.1. It started to work when I placed that
jpa-entities.jar file in root of EAR, like this:
ExampleApp.ear
/ejbModule1.jar
/ejbModule2.jar
/warModule1.jar
/jpa-entities.jar

I am not sure if the documentation I was reading was wrong or
Glassfish does it it's own, incorrect way.

--
Witold Szczerba