Module org.eclipse.persistence.core
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 Summary
Modifier and TypeMethodDescriptiondefault StringJSON parameter marker in SQL expression ofPreparedStatement.default <T> TgetJsonDataFromResultSet(ResultSet resultSet, int columnNumber, Class<T> type) Retrieve JSON data from JDBCResultSet.default booleanisJsonType(Type type) Check whether providedTypeis JSON type.default <T> TUnwrap thisDatabaseJsonPlatforminstance as provided class.default voidupdateClassTypes(Map<String, Class<?>> classTypeMapping) Update the mapping of class types to database types for the schema framework.default voidupdateFieldTypes(Hashtable<Class<?>, FieldTypeDefinition> fieldTypeMapping) Update the mapping of database types to class types for the schema framework.
-
Method Details
-
getJsonDataFromResultSet
default <T> T getJsonDataFromResultSet(ResultSet resultSet, int columnNumber, Class<T> type) throws SQLException Retrieve JSON data from JDBCResultSet.- Type Parameters:
T- target type to return- Parameters:
resultSet- source JDBCResultSetcolumnNumber- index of column in JDBCResultSettype- target class to return, this class will be used to cast returned value- Returns:
- JSON data from JDBC
ResultSetasStringto be parsed byJsonTypeConverter - Throws:
SQLException- if data could not be retrieved
-
updateFieldTypes
Update the mapping of database types to class types for the schema framework.- Parameters:
fieldTypeMapping-Mapwith mappings to be updated.
-
updateClassTypes
Update the mapping of class types to database types for the schema framework.- Parameters:
classTypeMapping-Mapwith mappings to be updated.
-
isJsonType
Check whether providedTypeis JSON type. JSON type is any class that implementsjakarta.json.JsonValueinterface. Default implementation always returnsfalse, becausejakarta.json.JsonValueinterface is not supported in core module without extensions.- Parameters:
type- tyoe to be checked- Returns:
- value of
truewhen provide type implementsjakarta.json.JsonValueinterface orfalseotherwose
-
customParameterMarker
JSON parameter marker in SQL expression ofPreparedStatement. Default value is SQL parameter placeholder character?.- Returns:
- JSON parameter marker in SQL expression for current database platform.
-
unwrap
Unwrap thisDatabaseJsonPlatforminstance 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
DatabaseJsonPlatforminstance as provided class - Throws:
IllegalArgumentException- when unwrap of thisDatabaseJsonPlatforminstance is not possible
-