Friday, March 13, 2009

Why do the create() or find() method return the remote reference or a

Question :Why do the create() or find() method return the remote reference or a
primary key only? (EJB)

Answer :The EJB Specification prohibits this behavior, and the weblogic.ejbc
compiler checks for this behavior and prohibits any polymorphic type of
response from a create() or find() method.
The reason the create() and find() methods cannot return any object or
primitive type is similar to the reason that regular constructors can be cast
into the class itself or any of it?s super classes.
For example
A a = new A() or
A b = new B() where B is a child of A.
You cannot do, for example Vector v = new A();

No comments: