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

    Commit option B + read_only method = strange behaviour

    Kirill Paliy Newbie

      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?