Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-381

OpenJPA is not doing Optimistic locking when running in JEE evnironment

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Invalid
    • 1.0.0
    • 1.1.0
    • jdbc
    • None
    • JEE

    Description

      The follwoing code seems to be leaving isolation level to -1 (default) instead of setting a correct isolation level for the connections. I think this is not right because this is leaving the contianer to use its own default isolation level. It will be, for example, Repeatable-read when using IBM WebShpere.

      in DataSourceFactory.java:
      public static DecoratingDataSource installDBDictionary(DBDictionary dict,
      DecoratingDataSource ds, final JDBCConfiguration conf,
      boolean factory2)

      { ... ccd.setTransactionIsolation(conf.getTransactionIsolationConstant()); ... }

      with the default value set in JDBCConfigurationImpl.java:
      public JDBCConfigurationImpl(boolean derivations, boolean loadGlobals) {
      super(false, false);
      String[] aliases;

      schema = addString("jdbc.Schema");
      schemas = addStringList("jdbc.Schemas");

      transactionIsolation = addInt("jdbc.TransactionIsolation");
      aliases = new String[]

      { "default", String.valueOf(-1), "none", String.valueOf(Connection.TRANSACTION_NONE), "read-committed", String.valueOf (Connection.TRANSACTION_READ_COMMITTED), "read-uncommitted", String.valueOf (Connection.TRANSACTION_READ_UNCOMMITTED), "repeatable-read", String.valueOf (Connection.TRANSACTION_REPEATABLE_READ), "serializable", String.valueOf(Connection.TRANSACTION_SERIALIZABLE) }

      ;
      transactionIsolation.setAliases(aliases);
      transactionIsolation.setDefault(aliases[0]);
      transactionIsolation.set(-1);
      transactionIsolation.setAliasListComprehensive(true);
      ...
      }

      The fix of this is to set it to "Read-Committed" which will make it in sync with JDBC direct connections.

      Attachments

        Activity

          People

            Unassigned Unassigned
            dtlee Daniel Lee
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: