The point is that the declaration of your ejbCreate() must specify that you 
will return the PrimKeyClass. In the implementation of the ejbCrate() however 
you just return null - a PrimKeyClass null.

That's how I do it and that's what I think is correct with respect to the 
spec.

Yours

Armin Michel

> When I generate a CMP bean with a Primary Key Class, it compiles and
> packages fine as far as the java side is concerned, however, when it is
> deployed, it has an issue.
>
> According to page 69 of the J2EE developers guide (I checked to be sure
> I wasn't just talking about anything), it says that if the bean has
> Container Managed Persistence, then the ejbCreate method should return
> null... the container handles that along with ejbFindByPrimaryKey...
>
> So, I have left it as null, but am using a custom Primary Key class.
> When I try to deploy it, it says:
>
> Error compiling ... filename ... method public void ... ejbCreate()
> throws javax.ejb.CreateException, java.rmi.RemoteException doesn't
> return a ... PrimaryKey (the path to the primary key class)
>
> Then the deploy fails.
>
> In JBoss, just to see what it had to say, it at least will deploy it but
> still gives a warning saying:
>
> "The return type of an ejbCreate(...) method must be the entity bean
> primary key type."
>
>
> From what I can tell in the documentation, these errors are wrong
>
> On a BMP bean, then yes I should have to return the Primary Key class
> type from the ejbCreate method, this is stated in the developers guide,
> but not for a CMP bean.
>
> In the 1.3 preview release of the developers guide, it states the same
> thing for BMP beans, however, it doesn't say anything about CMP -- it
> says TBD ... maybe To Be Discussed... like TBA, I don't know... but
> considering we're still using 1.2.1 standards, I'd like to know if I'm
> just completely wrong, or this issue has been overlooked in the
> orionserver (and jboss to some degree) deployment.
>
> If it has changed since earlier versions of EJB specs and I'm just not
> seeing it, I'd appreciate someone explaining it to me.
>
> I've run this through VisualAge Enterprise Edition 3.5 as well... it
> works fine with ejbCreate returning null on a CMP with a primary key
> class, and if I try to tell it to return the key type, then it flags
> warnings about it.
>
> I can fool it into thinking everything is alright by setting the
> ejbCreate to return the primary key, but is this the correct way of
> doing this considering what the specs say?
>
> Thanks in advance.
>
>
> --
> Ben Christensen
> Novisum Development Inc.
> www.novisum.com
> [EMAIL PROTECTED]
> 780-909-4707

Reply via email to