My insert query returns the UUID of the record that was inserted. Below is the relevant code.
KeyHolder keyHolder = new GeneratedKeyHolder();
template.update(connection -> {
PreparedStatement ps = connection.prepareStatement(insertQuery);
ps.setString(1, stateName);
ps.setString(2, stateAb);
ps.setObject(3, propertyDetailsObject);
return ps;
}, keyHolder);
I'm using a long CTE query that ends with select id from tmpproperty limit 1;
I have shortened things here for easier readability.
But I get the following exception
org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; A result was returned when none was expected.; nested exception is org.postgresql.util.PSQLException: A result was returned when none was expected.
I found the above example online and was expecting it to work. Any idea what I should be doing differently?