We use DB2 as one of our data sources for our application. We are currently in the process of converting all the JBoss CMP stuff over to raw Hibernate using Spring and annotations. One of the things I consistently run into is the use of ints as booleans. This was done because DB2 lacks a true Boolean type (at least this is what I am told by the DBAs).
I would like to modify the method signatures such that the return a true primative boolean type rather than an int, but I am not sure how to do this.
For instance, we have something like this:
Code:
@Basic
@Column (name="PROFILE_ACTIVE")
public int getProfileActive() {
return this.profileActive;
}
public void setProfileActive(int profileActive) {
this.profileActive = profileActive;
}
which I would like to read more like:
Code:
@Basic
@Column (name="PROFILE_ACTIVE")
public boolean isProfileActive() {
return this.profileActive;
}
public void setProfileActive(boolean profileActive) {
this.profileActive = profileActive;
}
having Hibernate take care of converting the boolean to a 1 or 0 for me. Is this legal? If I did this, would all hell break looks, or would this actually work even though the underlying database has this column defined as an smallint(5)?