Wednesday, October 2, 2013

Integer variable is zero when is it null in database

Integer variable is zero when is it null in database

I have declared variable as
private Integer projectId;
//with getters and setters
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?

No comments:

Post a Comment