Class JdbcValueHandler.TimestampJdbcValueHandler

  • Enclosing class:
    JdbcValueHandler<T>

    protected static class JdbcValueHandler.TimestampJdbcValueHandler
    extends JdbcValueHandler<java.sql.Timestamp>
    A java.sql.Timestamp JDBC value handler.

    This JdbcValueHandler accommodates databases that don't support sub-second precision. If the date-time field type is a CHAR(30) SQL type, java.sql.Timestamps will be stored as JDBC timestamp escape format strings (yyyy-mm-dd hh:mm:ss.fffffffff), referenced to UTC.

    • Constructor Detail

      • TimestampJdbcValueHandler

        protected TimestampJdbcValueHandler​(int jdbcType)
    • Method Detail

      • getJavaClass

        public java.lang.Class<java.sql.Timestamp> getJavaClass()
        Specified by:
        getJavaClass in class JdbcValueHandler<java.sql.Timestamp>
      • castAndSetValue

        protected void castAndSetValue​(java.sql.PreparedStatement ps,
                                       int parameterIndex,
                                       java.sql.Timestamp obj)
                                throws java.sql.SQLException
        Description copied from class: JdbcValueHandler
        Sets a value in a PreparedStatement. The obj argument is converted to the correct data type. Subclasses override this method to cast obj to the correct data type and call the appropriate PreparedStatement.setXxx method.
        Specified by:
        castAndSetValue in class JdbcValueHandler<java.sql.Timestamp>
        Throws:
        java.sql.SQLException
      • getValue

        public java.sql.Timestamp getValue​(java.sql.ResultSet rs,
                                           int columnIndex)
                                    throws java.sql.SQLException
        Description copied from class: JdbcValueHandler
        Returns a value from a ResultSet. The returned object is converted to the Java data type specified in the fieldtype file.
        Specified by:
        getValue in class JdbcValueHandler<java.sql.Timestamp>
        Parameters:
        rs - the ResultSet object
        columnIndex - the column index
        Returns:
        get value from result set
        Throws:
        java.sql.SQLException
      • newInstance

        protected JdbcValueHandler<java.sql.Timestamp> newInstance​(int sqlType)
        Description copied from class: JdbcValueHandler
        Returns a new instance of the object - initialized with the specified SQL type.
        Specified by:
        newInstance in class JdbcValueHandler<java.sql.Timestamp>
        Parameters:
        sqlType - the sql type
        Returns:
        returns a new instance