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 String
JSON parameter marker in SQL expression ofPreparedStatement
.default <T> T
getJsonDataFromResultSet
(ResultSet resultSet, int columnNumber, Class<T> type) Retrieve JSON data from JDBCResultSet
.default boolean
isJsonType
(Type type) Check whether providedType
is JSON type.default <T> T
Unwrap thisDatabaseJsonPlatform
instance as provided class.default void
updateClassTypes
(Map<String, Class<?>> classTypeMapping) Update the mapping of class types to database types for the schema framework.default void
updateFieldTypes
(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 JDBCResultSet
columnNumber
- index of column in JDBCResultSet
type
- target class to return, this class will be used to cast returned value- Returns:
- JSON data from JDBC
ResultSet
asString
to 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
-Map
with mappings to be updated.
-
updateClassTypes
Update the mapping of class types to database types for the schema framework.- Parameters:
classTypeMapping
-Map
with mappings to be updated.
-
isJsonType
Check whether providedType
is JSON type. JSON type is any class that implementsjakarta.json.JsonValue
interface. Default implementation always returnsfalse
, becausejakarta.json.JsonValue
interface is not supported in core module without extensions.- Parameters:
type
- tyoe to be checked- Returns:
- value of
true
when provide type implementsjakarta.json.JsonValue
interface orfalse
otherwose
-
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 thisDatabaseJsonPlatform
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 thisDatabaseJsonPlatform
instance is not possible
-