can POJO use SessionContext to handle CMT?

Discussions

EJB programming & troubleshooting: can POJO use SessionContext to handle CMT?

  1. can POJO use SessionContext to handle CMT? (3 messages)

    can I implement a method within a session bean like below:

    public boolean executeTransaction() {
     // call a pojo class to handle the transaction
     Executer exe = new Executer;
     return exe.run(getSessionContext());

    }

    inside class Executer:
    public boolean run(SessionContext ctx) {
     // lookup all the local homes
     try {
      // create EJB CMP entry
      CarLocal carlocal = carLocalHome.create();

      // create another EJB CMP entry
      InsuranceLocal insuranceLocal = insuranceLocalHome.create();
      return true;
     } catch (CreateException ex) {
      ctx.setRollbackOnly();
     }

     return false;

     

    }

    Threaded Messages (3)

  2. Henry from Greenlight?[ Go to top ]

    Hmmm... same name, code with variables mentioning cars and insurance...
    are you the same Henry Chan who worked for Greenlight.com?

    (sorry, don't know the answer to your question)
  3. Henry from Greenlight?[ Go to top ]

    Sorry. No.
  4. It should work, as long as you don't start a new thread to do transaction execution in your POJO.