0 Replies Latest reply on Apr 14, 2005 3:34 PM by kpaliy

    Commit option B + read_only method = strange behaviour

    kpaliy

      I have some entity bean with commit option B, it has most getters marked as read-only. I start transaction on client, obtain instance of bean and call couple of those methods. I expect ejbLoad only once, but it is called 3 times (ie before each business method). If I remove read-only attribute, ejbLoad is called only once, as expected. It looks like context gets invalidated in EntitySynchronizationInterceptor, here:

      if(isReadOnly && ctx.hasTxSynchronization() == false)
      {
      switch(commitOption)
      {
      // Keep instance active, but invalidate state
      case ConfigurationMetaData.B_COMMIT_OPTION:
      // Invalidate state (there might be other points of entry)
      ctx.setValid(false);
      break;

      So, the question is - is this a bug or using extensions like read-only flag doesn't guarantee meeting EJB spec?