Hey Mikalai, I like that! And yes, I think that works -- the create() has no choice, while the ejbCreate() can do whatever it wants -- depending on whether it *really* might throw the exception.
Actually, the rules about ejbCreate() are the same as for any other
Java implementation -- you do NOT have to declare an exception for an interface implementation method, even though that exception is declared in the interface. You must declare it in your implementation only if you might actually throw it.
OK, but having said all that... there *are* some deployment tools that might actually *force* you to declare the CreateException on the ejbCreate() method, and in general, it is considered a good practice even if you do NOT have to declare it.
So, for the exam -- the rules are according to the spec: create() MUST declare it, ejbCreate() CAN declare it.
But for real world --
you should probably declare a CreateException on your ejbCreate() as well. Remember, the Container might actually deploy a *subclass* of your bean class, and decide to do whatever it wants. If you haven't declared the CreateException (a checked exception) on your ejbCreate methods, the subclass won't be allowed to declare it (or throw it).
Anyway, I like the boss/employee thing
cheers,
Kathy