users@glassfish.java.net

Re: Including a persistence archive in an EJB module

From: <glassfish_at_javadesktop.org>
Date: Thu, 25 Oct 2007 03:43:13 PDT

> 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

but the ejb module is not deployable.

Are there any steps that I have to take ?
Specifying the entity classes jar file in persistence.xml doesn't seem to work (<jar-file>Persistence.jar</jar-file>).

Basically I'm confused about including library resources in EJB modules, reading the j2ee specs doesn't help, could you enlighten me a bit, please ?
[Message sent by forum member 'kolmis' (kolmis)]

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