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!
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! 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?