Hi all,

I have the following doubts regarding the use of reflection API to
locate business methods within a Session bean, and to invoke the
method.

// Remote Interface
public interface MyBean extends EJBObject {
public void execute (String sMethodName, Vector vParam) throws
RemoteException;
}

// Implementation class
public class MyBeanEJB implements SessionBean {
// Stateless Session Bean
public void execute (String sMethodName, Vector vParam) {
Class oClass = this.getClass ();
Class [] aParamTypes = {Vector.class};
Method oMethod = oClass.getMethod (sMethodName, aParamTypes);
Object [] aParamValues = {vParam};
oMethod.invoke (this, aParamValues);
}

public void BisMethodA (Vector aParamValues) {
// execute business logic A
}

public void BisMethodB (Vector aParamValues) {
// execute business logic B
}
}

The above bean works just fine in my machine. However,
I have one question regarding transaction support provided by EJB
container. When invoking business method (i.e. BisMethodA etc) this
way, will the EJB container still be able to handle transaction
correctly for me. Since this is a Stateless session bean and I have
set the tx_attribute to TX_Required, I would want every method
invocation to be within a proper transaction context. Please take
notes that all my business methods are not declared in my bean's
remote interface, instead only the "execute" method is included in the
remote interface. Will EJB server add necessary transaction support
for these methods though they are not defined in the remote interface.

Thanks & regards,
KT

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to