fixed dbunit jsonb type

Former-commit-id: 8842aa66dc
embedded-to-json
Jens Pelzetter 2020-05-23 20:43:45 +02:00
parent 12cc5f5ea7
commit c49dc8e31a
2 changed files with 7 additions and 11 deletions

View File

@ -102,6 +102,7 @@ public final class DependenciesHelpers {
* {@code ccm-core} module. * {@code ccm-core} module.
* *
* @return The dependencies of the {@code ccm-core} module. * @return The dependencies of the {@code ccm-core} module.
*
* @see #getDependenciesFromModule(java.lang.String) * @see #getDependenciesFromModule(java.lang.String)
* @see #getDependenciesFromPom(java.lang.String) * @see #getDependenciesFromPom(java.lang.String)
*/ */

View File

@ -20,7 +20,6 @@ package org.libreccm.testutils.dbunit;
import org.dbunit.dataset.datatype.AbstractDataType; import org.dbunit.dataset.datatype.AbstractDataType;
import org.dbunit.dataset.datatype.TypeCastException; import org.dbunit.dataset.datatype.TypeCastException;
import org.postgresql.util.PGobject;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -54,15 +53,11 @@ public class PgSqlJsonbType extends AbstractDataType {
final int column, final int column,
final PreparedStatement statement final PreparedStatement statement
) throws SQLException, TypeCastException { ) throws SQLException, TypeCastException {
final PGobject jsonObj = new PGobject();
jsonObj.setType("jsonb");
if (value == null) { if (value == null) {
jsonObj.setValue(null); statement.setObject(column, null, Types.OTHER);
} else { } else {
jsonObj.setValue(value.toString()); statement.setObject(column, value.toString(), Types.OTHER);
} }
statement.setObject(column, jsonObj);
} }
} }