Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8143283

JDBC 4.2 default methods java.sql.PreparedStatement.setObject should delegate

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P5 P5
    • None
    • 8u66
    • core-libs
    • x86
    • windows_8

      FULL PRODUCT VERSION :
      java version "1.8.0_66"
      Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
      Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)

      A DESCRIPTION OF THE PROBLEM :
      In JDBC 4.2 new default methods were added to the PreparedStatement interface:

      default void setObject(int parameterIndex, Object x, SQLType targetSqlType)
            throws SQLException {
              throw new SQLFeatureNotSupportedException("setObject not implemented");
          }

      Surely it should delegate to the old setObject method as follows:

      default void setObject(int parameterIndex, Object x, SQLType targetSqlType)
            throws SQLException {
              setObject(parameterIndex,x,targetSqlType.getVendorTypeNumber());
          }


      With the current implementation there is no point invoking the new method EVER, as there is always a chance that you will change driver to something that doesn't implement it.


      REPRODUCIBILITY :
      This bug can be reproduced always.

            lancea Lance Andersen
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: