insert null into Integer column using JDBC - minor formatting

This commit is contained in:
Mladen Savic 2021-06-09 10:08:55 +02:00
parent 1a6361606c
commit 59b3081d46
1 changed files with 2 additions and 2 deletions

View File

@ -21,10 +21,10 @@ public class InsertNullUnitTest {
preparedStatement.setInt(1, person.getId());
preparedStatement.setString(2, person.getName());
preparedStatement.setString(3, person.getLastName());
if (person.getAge() == null){
if (person.getAge() == null) {
preparedStatement.setNull(4, Types.INTEGER);
}
else{
else {
preparedStatement.setInt(4, person.getAge());
}
int noOfRows = preparedStatement.executeUpdate();