Any risk getting session bean reference not via lookup?
EJB3.0
@Remote
public interface A {
B getBReference();
}
@Remote
public interface B extends serializable{}
@MessageDriven
public class MDB{
@EJB
B Ref_from_JMS_OBJMSG;
sendObjectMessage(Ref_from_JMS_OBJMSG);
}
B Ref_from_lookup = (B)lookup(B's JNDI);
B Ref_from_remote_call = ((A)lookup(A's JNDI)).getBReference();
B Ref_from_JMS_OBJMSG = get From onMessage() method
I know Ref_from_remote_call references an SB reside in A's context, but rest two do not.
(Remote interface is not required to extends serializable)
What i want to know is:
Any risk or unpredictable behavior of using Ref_from_JMS_OBJMSG or Ref_from_remote_call reference, are they bad practice?
[789 byte] By [
SDLa] at [2007-11-27 4:53:38]

# 1
Both EJB 2.x and EJB 3.0 Remote references can themselves be passed as parameters and return
values from EJB Remote methods.It's perfectly legal and a fine practice.
However, there is no requirement that such references be capable of being passed directly within a
JMS message, regardless of whether the interface is marked as Serializable.
The only portable way to send an EJB Remote reference through a JMS message would be to use
a 2.x Remote reference and acquire its Handle.The Handle object is serializable, so it could be
passed within a JMS ObjectMessage, provided that the consumer of that message is a Java EE
application server in which that EJB is deployed.
--ken
ksaksa at 2007-7-12 10:08:08 >
