Interface DatabaseJsonPlatform

All Known Implementing Classes:
JsonPlatform, MySQLJsonPlatform, Oracle21JsonPlatform, PostgreSQL10JsonPlatform

public interface DatabaseJsonPlatform
Database platform JSON extension. Provides an interface to implement JSON specific features.
  • Method Details

    • getJsonDataFromResultSet

      default <T> T getJsonDataFromResultSet(ResultSet resultSet, int columnNumber, Class<T> type) throws SQLException
      Retrieve JSON data from JDBC ResultSet.
      Type Parameters:
      T - target type to return
      Parameters:
      resultSet - source JDBC ResultSet
      columnNumber - index of column in JDBC ResultSet
      type - target class to return, this class will be used to cast returned value
      Returns:
      JSON data from JDBC ResultSet as String to be parsed by JsonTypeConverter
      Throws:
      SQLException - if data could not be retrieved
    • updateFieldTypes

      default void updateFieldTypes(Hashtable<Class<?>,FieldTypeDefinition> fieldTypeMapping)
      Update the mapping of database types to class types for the schema framework.
      Parameters:
      fieldTypeMapping - Map with mappings to be updated.
    • updateClassTypes

      default void updateClassTypes(Map<String,Class<?>> classTypeMapping)
      Update the mapping of class types to database types for the schema framework.
      Parameters:
      classTypeMapping - Map with mappings to be updated.
    • isJsonType

      default boolean isJsonType(Type type)
      Check whether provided Type is JSON type. JSON type is any class that implements jakarta.json.JsonValue interface. Default implementation always returns false, because jakarta.json.JsonValue interface is not supported in core module without extensions.
      Parameters:
      type - tyoe to be checked
      Returns:
      value of true when provide type implements jakarta.json.JsonValue interface or false otherwose
    • customParameterMarker

      default String customParameterMarker()
      JSON parameter marker in SQL expression of PreparedStatement. Default value is SQL parameter placeholder character ?.
      Returns:
      JSON parameter marker in SQL expression for current database platform.
    • unwrap

      default <T> T unwrap(Class<T> type)
      Unwrap this DatabaseJsonPlatform instance as provided class.
      Type Parameters:
      T - target type to unwrap
      Parameters:
      type - target class to unwrap, this class will be used to cast returned value
      Returns:
      this DatabaseJsonPlatform instance as provided class
      Throws:
      IllegalArgumentException - when unwrap of this DatabaseJsonPlatform instance is not possible