Module org.eclipse.persistence.core
Interface DatabaseJsonPlatform
-
public interface DatabaseJsonPlatformDatabase platform JSON extension. Provides an interface to implement JSON specific features.
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default StringcustomParameterMarker()JSON 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(Class<T> type)Unwrap 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 Detail
-
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
default void updateFieldTypes(Hashtable<Class<?>,FieldTypeDefinition> fieldTypeMapping)
Update the mapping of database types to class types for the schema framework.- Parameters:
fieldTypeMapping-Mapwith 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-Mapwith mappings to be updated.
-
isJsonType
default boolean isJsonType(Type type)
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
default String 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
default <T> T unwrap(Class<T> type)
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
-
-