Код: Выделить всё
create type custom_type as
(
a text,
b text,
c boolean
);
Код: Выделить всё
CREATE OR REPLACE FUNCTION test(strings custom_type[]) RETURNS VOID
AS
$$
BEGIN
end;
$$ language plpgsql;
Код: Выделить всё
try (Connection connection = DataSource.getConnection()) {
String call = "select test(?)";
Array sqlArray = connection.createArrayOf("custom_type", new CustomTypeDTO[]{
new CustomTypeDTO("123456", "11221", "false"),
new CustomTypeDTO("123426", "113221", "false"),
});
PreparedStatement preparedStatement = connection.prepareStatement(call)
preparedStatement.setArray(1, sqlArray);
preparedStatement.execute();
} catch (SQLException e) {
e.printStackTrace();
}
ОШИБКА: неверный литерал записи: "main.java.test.dto.CustomTypeDTO@4802796d"
Подробно: отсутствует левая скобка.
Подробнее здесь: https://stackoverflow.com/questions/781 ... -parameter
Мобильная версия