RE: CMP Primary Key and ejbCreate

2001-05-15 Thread Robert Nicholson

The signature for ejbCreate is the same for CMP and BMP. The idea is that
you should be able to subclass a CMP bean to make it BMP. ie. vendors can
ship beans designed to work with CMP but when that's too inflexible you can
subclass and make BMP beans instead.

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]]On Behalf Of Ben
 Christensen
 Sent: Monday, May 14, 2001 8:15 PM
 To: Orion-Interest
 Subject: CMP Primary Key and ejbCreate


 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








RE: CMP Primary Key and ejbCreate

2001-05-15 Thread Robert Nicholson

It's null but the return type of ejbCreate is always the primary key class
never void.

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]]On Behalf Of Ben
 Christensen
 Sent: Monday, May 14, 2001 8:15 PM
 To: Orion-Interest
 Subject: CMP Primary Key and ejbCreate


 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








Re: CMP Primary Key and ejbCreate

2001-05-15 Thread Armin Michel

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




Re: CMP Primary Key and ejbCreate

2001-05-15 Thread Jeff Hubbach

Ben,

From page 169 of Oreilly's Enterprise JavaBeans 2nd Edition:

The ejbCreate() method returns void in EJB 1.0 and a null value of type
ShipPK for the bean's primary key in EJB 1.1. The end result is the same:
in both EJB 1.0 and EJB 1.1, the return value of the ejbCreate() method for
a container-managed beain is ignored. EJB 1.1 changed its return value from
void to the primary key type to facilitate subclassing; the change was made
so that it's easier for a bean-managed bean to extend a container-managed
bean.

In short, the method signature in EJB 1.0 was void ejbCreate(), while in
EJB 1.1 it's BeanPK ejbCreate().

Jeff.

Ben Christensen wrote:

 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

--
Jeff Hubbach
Internet Developer
New Media Designs, Inc.
www.nmd.com