fixed dbunit jsonb type

Jens Pelzetter 2020-05-23 20:43:45 +02:00
parent 02fa324249
commit 8842aa66dc
2 changed files with 7 additions and 11 deletions

View File

@ -66,8 +66,8 @@ public final class DependenciesHelpers {
.collect(Collectors.toList()).toArray(new File[0]); .collect(Collectors.toList()).toArray(new File[0]);
Arrays.stream(libs) Arrays.stream(libs)
.forEach(lib -> System.err.printf( .forEach(lib -> System.err.printf(
"Found dependency '%s'...%n", "Found dependency '%s'...%n",
lib.getName())); lib.getName()));
return libs; return libs;
} }
@ -102,8 +102,9 @@ 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 #getDependenciesFromPom(java.lang.String) * @see #getDependenciesFromModule(java.lang.String)
* @see #getDependenciesFromPom(java.lang.String)
*/ */
public static File[] getCcmCoreDependencies() { public static File[] getCcmCoreDependencies() {
return getDependenciesFromModule("ccm-core"); return getDependenciesFromModule("ccm-core");

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);
} }
} }