EJB programming & troubleshooting: using Floyd's data access bean in transaction boundary

  1. im using jboss 4.0
    after reading the ejb's design patterns book
    i was woundering how can i use data access command bean (which is actually a pojo) under transaction.

    does writing the Command access code in an (CMT)ejb method will do the trick

    public Object getSomething(){
           Cmd = new InsertCommand();
           Object object = Cmd.getResults();
           return object;
  2. Placing the POJO in either a Stateless, Stateful or Entity Bean with the accessor method supporting or requiring a transaction will do the trick. That is, of course, expecting that you are using a DataSource from JBoss rather than loading a JDBC driver directly.