1 Reply Latest reply on Jan 14, 2005 9:07 AM by Bernd Zeitler

    Two EJB Related Question

    Deepak Jois Newbie

      1. Can I have stateful session bean that extends a normal Java object and implements the Session bean interface, and the calls a public method in the parent class inside a business method of the bean.

      For eg

      public class AnalysisTestBean extends AnalysisObject implements SessionBean {
       public AnalysisTestBean() {
       public void setSessionContext(SessionContext ctx)
       throws EJBException,
       RemoteException {
       public void ejbRemove() throws EJBException, RemoteException {
       public void ejbActivate() throws EJBException, RemoteException {
       public void ejbPassivate() throws EJBException, RemoteException {
       public void ejbCreate(String param) throws CreateException {
       * Business method
       * @ejb.interface-method view-type = "remote"
       public void analyze() {

      Here I have an Analysis parent object with ONLY a public method analyze(), no static members, and I am trying to design an EJB by inheriting it.

      2. Where do I put the Jar file containing the parent object Analysis in the Jboss distribution tree, so that it can be discovered by JBoss during deployment?

        • 1. Re: Two EJB Related Question
          Bernd Zeitler Expert

          1. yes, if the base class has a public constructor without arguments or is constructed within the beans constructor (but I would rather prefer delegation since I can't imagine why to use inheritance). And the base class must be serializable, when implementing a stateful session bean.
          2. depends on your deployment. Just deploy all your jars within one ear or just throw them into your deploy directory.