0 Replies Latest reply on Jan 3, 2008 4:41 AM by guix

    JBOSS 4.2.1  + EJB3.0 : Native executes don't rollback!

    guix

      Hi:
      I am using jboss 4.2.1 with ejb3 default configuration

      If I make a native query execute update in a Session bean:

      User user = new User(userId);
      myEntityManager.persist(user);
      
      String insertUserInOldTable = "insert into olduserstable values('" + userId + "');
      myEntityManager.createNativeQuery(insertUserInOldTable ).executeUpdate();
      
      String userCreate = "CREATE USER " + userId + " IDENTIFIED BY " + userPassword + " DEFAULT TABLESPACE TB1 TEMPORARY TABLESPACE TEMPORARY PROFILE P1";
      myEntityManager.createNativeQuery(userCreate).executeUpdate();


      If the "create user " statement fails, the Entity bean code rolls back correctly but the insert statement does not roll back.

      Why?

      We need this to maintain old tables (no ejbs) in sync with new tables (ejb3)