В настоящее время у меня есть этот код (упрощенный):
Код: Выделить всё
Map testRecord = new HashMap() {{
put("name", "whatever");
put("type", "planning");
}};
SimpleJdbcInsert insertTest = new SimpleJdbcInsert(jdbcTemplate)
.withTableName("test_table")
.usingColumns(testRecord.keySet().toArray(new String[0]))
.usingGeneratedKeyColumns("id");
Number testId = insertTest.executeAndReturnKey(testRecord);
Код: Выделить всё
PreparedStatementCallback; bad SQL grammar []; nested exception is org.postgresql.util.PSQLException: ERROR: column "type" is of type test_type but expression is of type character varying
Hint: You will need to rewrite or cast the expression.
Кто-нибудь знает, как я могу это исправить? Я попробовал добавить к строке "::test_type", но это тоже не сработало.
Подробнее здесь: https://stackoverflow.com/questions/791 ... jdbcinsert
Мобильная версия