OpenJPA
  1. OpenJPA
  2. OPENJPA-847

Retrieving database generated keys gets never enabled

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.0-M2
    • Fix Version/s: 1.3.0, 2.0.0-M2
    • Component/s: jdbc
    • Labels:
      None

      Description

      Support for getting generated keys (OPENJPA-736) needs a bit of more work - DBDictionary.supportsGetGeneratedKeys is always false.

      1. OPENJPA-847.patch
        4 kB
        Milosz Tylenda

        Issue Links

          Activity

          Hide
          Milosz Tylenda added a comment -

          DBDictionary says:

          metaData = conn.getMetaData();
          try

          { // JDBC3-only method, so it might throw a // AbstractMethodError isJDBC3 = metaData.getJDBCMajorVersion() >= 3; supportsGetGeneratedKeys = metaData.supportsGetGeneratedKeys(); }

          catch (Throwable t)

          { // ignore if not JDBC3 }

          However, DelegatingDatabaseMetaData.supportsGetGeneratedKeys always throws an exception:

          public boolean supportsGetGeneratedKeys() throws SQLException

          { throw new UnsupportedOperationException(); }

          Now , as OpenJPA requires Java 5 (JDBC 3), we probably can delegate all DelegatingDatabaseMetaData methods to the delegate or even get rid of DelegatingDatabaseMetaData completely.

          Show
          Milosz Tylenda added a comment - DBDictionary says: metaData = conn.getMetaData(); try { // JDBC3-only method, so it might throw a // AbstractMethodError isJDBC3 = metaData.getJDBCMajorVersion() >= 3; supportsGetGeneratedKeys = metaData.supportsGetGeneratedKeys(); } catch (Throwable t) { // ignore if not JDBC3 } However, DelegatingDatabaseMetaData.supportsGetGeneratedKeys always throws an exception: public boolean supportsGetGeneratedKeys() throws SQLException { throw new UnsupportedOperationException(); } Now , as OpenJPA requires Java 5 (JDBC 3), we probably can delegate all DelegatingDatabaseMetaData methods to the delegate or even get rid of DelegatingDatabaseMetaData completely.
          Hide
          Milosz Tylenda added a comment -

          The patch delegates all JDBC 3 methods to the delegate instead of throwing exceptions.

          Show
          Milosz Tylenda added a comment - The patch delegates all JDBC 3 methods to the delegate instead of throwing exceptions.
          Hide
          Milosz Tylenda added a comment -

          Change applied to trunk.

          Show
          Milosz Tylenda added a comment - Change applied to trunk.
          Hide
          Milosz Tylenda added a comment -

          Change applied also to 1.3.x branch.

          Show
          Milosz Tylenda added a comment - Change applied also to 1.3.x branch.

            People

            • Assignee:
              Milosz Tylenda
              Reporter:
              Milosz Tylenda
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development