ejb@glassfish.java.net

Re: Ejb-jar File Requirements

From: Kenneth Saks <Kenneth.Saks_at_Sun.COM>
Date: Fri, 16 Nov 2007 09:08:50 -0500

Hubert, Eric wrote:
> Hello all!
>
> During an EAR deployment Glassfish v2 b58g complaints if one declares an
> EJB module which only contains EJB 3.0 style entities (annotated POJOs)
> and forces one to package them as a Java library. Is there really a need
> to do that according to confirm with the EJB 3.0 spec? I ask as other
> implementations don't force the application assembler to package his
> application in this way.
> The output in server.log states "A valid ejb jar requires at least one
> session, entity (1.x/2.x style), or message driven bean."
>
> Could someone please point me to the source of this requirement in the
> EJB 3.0 spec! I couldn't find it. Although I agree it is perfectly fine
> to package those annotated POJOs in a plain java library and reference
> it in persistence.xml I don't understand why to force the application
> provider to do it in this way.
>
Hi Eric,

A Java Persistence Entity is not considered an EJB component. When a
persistence unit is defined within an ejb-jar, it only has visibility to
EJB components within that ejb-jar. Therefore, a persistence-unit
defined in an ejb-jar containing 0 EJB components is useless, since it
can't be accessed.

If you're using an .ear you can package the persistence unit at the .ear
level. In that case, any module in the .ear will have visibility to it.


> Regards,
> Eric
>
> --
> Eric Hubert
> Software Architect
> Associate Director Research & Development
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ejb-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: ejb-help_at_glassfish.dev.java.net
>
>