I have declared variable as
private Integer projectId;
public void setProjectId(Integer projectId) {
this.projectId= projectId;
}
public Integer getProjectId() {
return projectId;
}
While retrieving values from database, if projectId is null in database table, it is shown as 0
e.g.
log.info("?? "+projectList.get(1).getProjectId());
the result of the above is 0
.
Why it is shown as 0
although it is null in table and how can I make this is as null
when it is null
in table?
Edit 1
while (rs.next()) {
projectList.add(mapProjects(resultSet));
}
private static Project mapProjects(ResultSet rs)
throws SQLException {
return new Project ((rs.getInt("ID")),
(rs.getInt("PROJECT_ID")),