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

DBDictionary doesn't look on whole hierarchy during finding xml with error codes

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.3.0
    • Fix Version/s: None
    • Component/s: jdbc
    • Labels:
      None

      Description

      We have custom SQLServerDictionary:

      public class CustomSQLServerDictionary extends SQLServerDictionary {
      ...
      }

      Adding another class in that hierarchy:

      public class Custom2SQLServerDictionary extends CustomSQLServerDictionary {
      ...
      }

      leads to broken sql codes. OpenJPA can't find sql codes from SQLServerDictionary.

      There is code in DBDictionary which looks just at one level of hierarchy:

      String rsrc = "sql-error-state-codes.xml";
      // We'll allow sub-classes to override the stream for custom err codes
      // @edu.umd.cs.findbugs.annotations.SuppressWarnings(value="UI_INHERITANCE_UNSAFE_GETRESOURCE")
      InputStream stream = getClass().getResourceAsStream(rsrc);
      String dictionaryClassName = getClass().getName();
      if (stream == null) { // User supplied dictionary but no error codes xml
      // use default
      stream = DBDictionary.class.getResourceAsStream(rsrc);
      dictionaryClassName = getClass().getSuperclass().getName();
      }

      It seems that instead of looking on getSuperclass it should look at whole hierarchy.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              daxzel Tsarevskiy Andrey
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: