aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Where are create() and ejbCreate() methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Where are create() and ejbCreate() methods " Watch "Where are create() and ejbCreate() methods " New topic
Author

Where are create() and ejbCreate() methods

Manikandan Jayaraman
Ranch Hand

Joined: Sep 15, 2004
Posts: 230
Hi All,
Was going through the API spec. of J2EE1.4 and was confused at one point.

The interfaces SessionBean and EntityBean does not have ejbCreate() method declared in them. Is it not mandatory to have an ejbCreate() in these interfaces? How do we force bean developers to have this method in their bean code then?

Also, there is no create() method in EJBHome. How will we mandate this in our home interface. I know that the vendor specific application server is going to generate the "Home Object" code for me, but it will use my home interface and create the home object. Right?

So how do we mandate the presence of create() and ejbCreate() in our Home interface and Bean respectively? Please explain!


Regards,<br />Mani<br />SCJP 1.4 (95%)<br />SCWCD 1.4 (94%)
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
The EJB spec isn't completely enforced by the compiler. That is, a bean that doesn't have an ejbCreate() may still compile, but it won't be able to successfully deployeed into an EJB container. That's where the term "contract" comes from. The compiler will let us violate the contract, but we promise not to.


Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
Manikandan Jayaraman
Ranch Hand

Joined: Sep 15, 2004
Posts: 230
Nathaniel! Thanks for your reply! But, why was this not forced at the interface itself? If forced, the compiler itself will mandate these methods to be present in the Bean and the Home interface class?

Any restrictions/problems because of which they were not able to include this method in the interface?
David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
Well, for entity beans surely the interface cannot specify a parameterless ejbCreate() method as you may need one or more create methods all taking one or more parameters.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Where are create() and ejbCreate() methods