Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-1386

commit option B does not work with CMP 1.x

    XMLWordPrintable

Details

    Description

      When accessing a CMP 1.x entity bean with the commit option set to B, and the bean is already loaded (by a previous invocation), the bean is not loaded again from the database (as it should with commit option B). This can be easily verified by deploying such a bean and enabling sql logging.

      The cause of this bug is in the following method from JDBCCMP1xFieldBridge:

      public void resetPersistenceContext(EntityEnterpriseContext ctx)
      {
      if(isReadTimedOut(ctx))

      { JDBCContext jdbcCtx = (JDBCContext)ctx.getPersistenceContext(); jdbcCtx.setFieldState(jdbcContextIndex, new FieldState(jdbcCtx)); }

      }

      Assigning a 'new FieldState(jdbcCtx)' to the jdbcCtx effectively does nothing, because JDBCCMP1xFieldBridge.FieldState delegates to EntityState and the EntityState is not affected by this call. Hence, after this method, the state of the field is still "loaded", and thus this field is not part of the load-iterator created by JDBCEntityBridge.

      I think the fix is rather easy: just reset the field flags explicitely (as it is done in the cmp 2.x case), e.g.

      jdbcCtx.getEntityState().resetFlags(tableIndex);

      Attachments

        Activity

          People

            olubyans@redhat.com Alexey Loubyansky
            petertje_jira Peter Doornbosch (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: