Discussions

EJB programming & troubleshooting: UserTransaction does not rollback ejb which are removed..

  1. I am trying to use UserTransaction on a "CMP managed" EJB ( called UtilConfigEJB) which has trans-attribute as "Required" on all methods ie "*"..

    Sample code :
     utx = EJBUtil.getEntityUserTransaction();
            utx.begin();

            UtilConfigHome home = EJBUtil.getUtilConfigHome();
            UtilConfigRemote remote = home.findByPrimaryKey(new Integer(1000) );
            remote.remove();
            utx.rollback();

    I am finding that after running above code the record with id "1000" is "deleted" from the database..
    ie there is no rollback done ..




  2. FYI.. I am trying this with weblogic 6.1..
    I also tried to explicity mark "remove" method
    with transaction attribute "Required" but
    it made no difference..

    The rollback seems to work fine, if it is done
    on any other method call on that CMP EJB..