Hi,
  Sorry ! I was not right when I said that EJB spec doesnt mandate that
bean-provider may not have to throw a creatException from ejbCreate methods.
It does mandate. It indicates that an application level error occured while
the container is creating the bean. Additionally the bean-provider is
recommended to mark the transaction for rollback only to play a safe
game,FYI.
  May be in the code which you have seen, they must be throwing an
Exception, a BusinessException that extends the CreateException and so may
be you havent seen those words of CreateException.


Regards,
Kris
-----Original Message-----
From: miki [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 11, 2002 8:54 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: ejbCreate and CreateException in EJB 2.0


kris,

Thank you for your comment.

Because I have experence with EJB 1.1 for production, I understand
what you mean. I also did check your interpretation with the j2ee
reference implementation and the result tells you are right.

But I still cannot read your interpretation from the EJB 2.0 spec.
Please read whole sentences of 10.6.4 ejbCreate subsection:

--- start ---
10.6.4 ejbCreate<METHOD> methods

The entity bean class must implement the ejbCreate<METHOD>(...)
methods that correspond to the create<METHOD>(...) methods
specified in the entity bean $B!G (Js home interface.

The entity bean class may define zero or more
ejbCreate<METHOD>(...) methods whose signa-tures must follow these
rules:

The method name must have ejbCreate as its prefix.

The method must be declared as public.

The method must not be declared as final or static.

The return type must be the entity bean $B!G (Js primary key type.

If the ejbCreate<METHOD>(...) method corresponds to a
create<METHOD>(...) on the entity bean $B!G (Js remote home interface,
the method arguments and return value types must be legal types
for RMI-IIOP.

The throws clause must define the javax.ejb.CreateException.
The throws clause may define arbitrary application specific exceptions.

--- end ---

In my previous mail, I pointed out the last paragraph of the
10.6.4.

It isn't obvious for me that "the throws" means "the throws of the
create<METHOD>(...)" because this subsection specifies ejbCreate()
not create().

I know a possibility of that "the throws" may refere to the last
method, which is "create()" in this case.

Sorry, English is my second language.

Miki

From: Ramakrishna N <[EMAIL PROTECTED]>
Subject: Re: ejbCreate and CreateException in EJB 2.0
Date: Fri, 8 Mar 2002 01:46:56 -0500

> That is in the HomeInterface not in the implementing since the Classes
that
> are generated by the Container will typically generate methods that wrap
> your implementation of ejbCreate and those will take care of things. As
far
> as I remember spec wont mandate for that throwing clause in the
> bean-implementation and hence that code.
>
>    Hope this helps;
> Regards,
> kris
>
> -----Original Message-----
> From: miki [mailto:[EMAIL PROTECTED]]
> Sent: Friday, March 08, 2002 8:34 AM
> To: [EMAIL PROTECTED]
> Subject: ejbCreate and CreateException in EJB 2.0
>
>
> Some popular EJB 2.0 books show useful entity bean samples, but I
> found many ejbCreate() methods without the throws clause for
> CreateException in the samples.
>
> For example, this ejbCreate() doensn't have the CreateException clause:
>
> public abstract class CustomerBean implements javax.ejb.EntityBean
> {
>   public Integer ejbCreate(Integer id) {
>     setId(id);
>     return null;
>   }
> ...
>
> EJB 2.0 spec (10.6.4 ejbCreate<METHOD> methods) states "The throws
> clause must define the javax.ejb.CreateException".
>
> I think this rule applys to CMP entities as well as BMP entities.
> Any comments?
>
> Miki

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to