1313import java .sql .SQLException ;
1414
1515@ MappedTypes (Property .class )
16- public class JsonTypeHandler extends BaseTypeHandler <Property <?> > {
16+ public class JsonTypeHandler extends BaseTypeHandler <Object > {
1717
1818 static ObjectMapper objectMapper = new ObjectMapper ().findAndRegisterModules ();
1919
2020 @ Override
21- public void setNonNullParameter (PreparedStatement ps , int i , Property <?> parameter , JdbcType jdbcType )
21+ public void setNonNullParameter (PreparedStatement ps , int i , Object parameter , JdbcType jdbcType )
2222 throws SQLException {
2323 try {
24- if (parameter .isPresent ()) {
25- ps .setString (i , objectMapper .writeValueAsString (parameter .get ()));
24+ Property <?> property = (Property <?>) parameter ;
25+ if (property .isPresent ()) {
26+ ps .setString (i , objectMapper .writeValueAsString (property .get ()));
2627 } else {
2728 ps .setObject (i , null );
2829 }
@@ -32,17 +33,17 @@ public void setNonNullParameter(PreparedStatement ps, int i, Property<?> paramet
3233 }
3334
3435 @ Override
35- public Property <?> getNullableResult (ResultSet rs , String columnName ) throws SQLException {
36- return Property . ofNullable ( rs .getString (columnName ) );
36+ public Object getNullableResult (ResultSet rs , String columnName ) throws SQLException {
37+ return rs .getString (columnName );
3738 }
3839
3940 @ Override
40- public Property <?> getNullableResult (ResultSet rs , int columnIndex ) throws SQLException {
41- return Property . ofNullable ( rs .getString (columnIndex ) );
41+ public Object getNullableResult (ResultSet rs , int columnIndex ) throws SQLException {
42+ return rs .getString (columnIndex );
4243 }
4344
4445 @ Override
45- public Property <?> getNullableResult (CallableStatement cs , int columnIndex ) throws SQLException {
46- return Property . ofNullable ( cs .getString (columnIndex ) );
46+ public Object getNullableResult (CallableStatement cs , int columnIndex ) throws SQLException {
47+ return cs .getString (columnIndex );
4748 }
4849}
0 commit comments