modifying parameters in a beanmethod


EJB programming & troubleshooting: modifying parameters in a beanmethod

  1. modifying parameters in a beanmethod (4 messages)

    Hi y'all!

    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 interface, but it doesn't work. Do I have to write extra code for the implementation of or what?

    Thanks in advance

    Patrick Gilhuijs
    patrickg at infosupport dot com

    Info Support,
    Our know-how,
    your competitive edge
    Einsteinstraat 22-1
    3902 HN Veenendaal
    The Netherlands
    Tel : + 31 (0) 318 55 20 20
    Fax: + 31 (0) 318 55 23 55
  2. 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.
  3. Hi,

    Can you please elaborate on your answer? How do you manage the remotely callable object? Please explain in detail.
  4. Check out Java Remote Method Invocation (RMI).

    There is also another current discussion on callbacks: EJBs and callbacks - can you do it?
  5. can u be more specific regarding the bean type etc.