0 Replies Latest reply on Aug 31, 2009 11:46 AM by Vasilii Lukoyanov

    BMT, entity persists into DB before tx commit

    Vasilii Lukoyanov Newbie


      In my application I want to perform several JSF action invocation inside one transaction. Therefore I decided to use BMT, but I run into problem that when entity is persisted it immediately (well, actually after action finished) flushed into DB (checked with pgadmin).

      Please, tell me where I'm wrong.
      Here is the STSB:

      public class AddCoursePlanAction  implements AddCoursePlan {
          private Log _log;
          @PersistenceContext(type = PersistenceContextType.EXTENDED)
          private EntityManager _em;
          /** Транзакция */
          private UserTransaction _tx;
          @In(value = "coursePlanHome", scope = ScopeType.CONVERSATION, required = false)
          private CoursePlanHome _plan;
          @In(value = "courseUnitHome", required = false)
          private CourseUnitHome _unit;
          public void requreTx() {
              try {
                  if (_tx.getStatus() == Status.STATUS_NO_TRANSACTION) {
              } catch (Exception e) {
                  _log.debug(e.getMessage(), e);
          public String addPlan() {
              return "success";
          @End(beforeRedirect = true)
          public String addUnit() {
              if (_unit == null) {
                  _log.debug("Категория пустая, не добавлено");
                  return "failure";
              if (_plan.getInstance().getItems() == null) {
                  _plan.getInstance().setItems(new HashSet<CourseUnit>());
              return "success";

      addUnit() action is called during nested conversation. Conversation is started from EntityHome.create().

      Thanks in advance, sorry for english.