- Posted by: patrick gilhuijs
- Posted on: March 05 2001 02:36 EST
I have a question. I wrote an simple EJB that performs an addition of two integers (class with three attributes; x, y and result) and returns the result in the result part of the class. However the client doesn't get the result back. I have the class implement the java.io.Serializable interface, but it doesn't work. Do I have to write extra code for the implementation of java.io.Serializable or what?
Thanks in advance
patrickg at infosupport dot com
your competitive edge
3902 HN Veenendaal
Tel : + 31 (0) 318 55 20 20
Fax: + 31 (0) 318 55 23 55
- modifying parameters in a beanmethod by Nathan Bronson on March 06 2001 17:18 EST
- modifying parameters in a beanmethod by Neeraj Nargund on March 07 2001 15:07 EST
The EJB method's parameters are only marshalled and sent _to_ the method (the "in" modifier for CORBA people). They are not returned. (This is the way Java RMI works, not just EJB.)
If the parameter and the return value are small, the best performing work-around is to return some sort of a serializable object that contains the new values. The returned object might contain just the deltas and provide a method to apply them to the original parameter.
If the parameter is large but only a small amount of it is actually needed at the remote end, or if you really need to modify it in place, you can make the parameter a remotely callable object. Then the original method invocation only passes the stub reference, and the EJB operates on the parameter object via a second layer of remote calls.
Can you please elaborate on your answer? How do you manage the remotely callable object? Please explain in detail.
Check out Java Remote Method Invocation (RMI).
There is also another current discussion on callbacks: EJBs and callbacks - can you do it?
can u be more specific regarding the bean type etc.