Class PostgreSQL10JsonPlatform

java.lang.Object
org.eclipse.persistence.json.JsonPlatform
org.eclipse.persistence.pgsql.PostgreSQL10JsonPlatform
All Implemented Interfaces:
DatabaseJsonPlatform, PostgreSQL10Platform.PostgreSQL10JsonExtension

public class PostgreSQL10JsonPlatform extends JsonPlatform implements PostgreSQL10Platform.PostgreSQL10JsonExtension
PostgreSQL 10 JSON database platform.
  • Constructor Details

    • PostgreSQL10JsonPlatform

      public PostgreSQL10JsonPlatform()
  • Method Details

    • updateClassTypes

      public void updateClassTypes(Map<String,Class<?>> classTypeMapping)
      Update the mapping of Postgres 10 database types to class types for the schema framework.
      Specified by:
      updateClassTypes in interface DatabaseJsonPlatform
      Parameters:
      classTypeMapping - Map with mappings to be updated.
    • updateFieldTypes

      public void updateFieldTypes(Hashtable<Class<?>,FieldTypeDefinition> fieldTypeMapping)
      Update the mapping of JSON class types to Postgres 10 database types for the schema framework.
      Specified by:
      updateFieldTypes in interface DatabaseJsonPlatform
      Overrides:
      updateFieldTypes in class JsonPlatform
      Parameters:
      fieldTypeMapping - Map with mappings to be updated.
    • convertJsonValueToDataValue

      public <T> T convertJsonValueToDataValue(JsonValue jsonValue) throws PersistenceException
      INTERNAL: Convert JSON value field to JDBC statement type. Postgres JSON storage type is JSONB and target Java type is PGobject.
      Overrides:
      convertJsonValueToDataValue in class JsonPlatform
      Type Parameters:
      T - classification type
      Parameters:
      jsonValue - source JSON value field
      Returns:
      converted JDBC statement type
      Throws:
      PersistenceException
    • getJsonDataFromResultSet

      public <T> T getJsonDataFromResultSet(ResultSet resultSet, int columnNumber, Class<T> type) throws SQLException
      Retrieve JSON data from JDBC ResultSet. JSON data retrieved from Postgres JDBC ResultSet are returned as PGobject instance. It must be converted to String first to be accepted by common JsonTypeConverter.
      Specified by:
      getJsonDataFromResultSet in interface DatabaseJsonPlatform
      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 common JsonTypeConverter
      Throws:
      SQLException - if data could not be retrieved
    • isPgObjectInstance

      public boolean isPgObjectInstance(Object parameter)
      Check whether provided instance is an instance of PGobject.
      Specified by:
      isPgObjectInstance in interface PostgreSQL10Platform.PostgreSQL10JsonExtension
      Parameters:
      parameter - an instance to check
      Returns:
      value of true when provided instance is an instance of PGobject or false otherwise