users@glassfish.java.net

Re: Including a persistence archive in an EJB module

From: Sahoo <Sahoo_at_Sun.COM>
Date: Thu, 25 Oct 2007 19:34:17 +0530

glassfish_at_javadesktop.org wrote:
>> Looks like a NetBeans project setup issue to me.
>> 1. Have you set dependency from ejb-module to
>> persistence project?
>> 2. If yes, have you ticked the "Build Required
>> Projects" check-box in
>> the panel when you set the dependency?
>>
>
> The setup I'm using is the following:
> I set the dependency in the EJB module project like this: I choose [b]Add JAR/Folder[/b] and point the folder to [b]PersistenceProject/build[/b] dir. Thus the EJB module project doesn't have access to the Persistence project's enttity classes java sources, it has access to compiled classes only (if they exist).
> This gets me what Cheng Feng was saying in the first reply - a builded jar with the following contents
>
> META-INF/
> META-INF/MANIFEST.MF
> META-INF/persistence.xml
> META-INF/ejb-jar.xml
> my.persistence.project/Entity1.class
> my.persistence.project/Entity2.class
>
> and the ejb module can be deployed without problems. The problem with this setup that it can't rebuild the persistence project depended upon automatically.
>
> Now if I specify the dependency as a project dependency ([b]Add Project[/b]), the rebuilding of the dependency persistence project works, the resulting ejb jar structure is this:
>
> META-INF/
> META-INF/MANIFEST.MF
> META-INF/persistence.xml
> META-INF/ejb-jar.xml
> Persistence.jar
>
>
There is a check box, which is ticked by default, in the library panel
which is responsible for bundling the jar. You have to uncheck that to
avoid Persistence.jar being part of ejb-jar.

Thanks,
Sahoo