I have a simple class mapped to a sinple table, in that class I have an int value which is mapped to an int value in the MySQL database -
Code:
private int next;
public int getNext() {
return next;
}
public void setNext(int next) {
this.next = next;
}
I want next to be a boolean, but because MySQL doesn't support boolean data types it is a TINY_INT 1 or 0. I introduce boolean methods to my class to mask the MySQL boolean issue.
My class now looks like this
Code:
private int next;
public int getNext() {
return next;
}
public void setNext(int next) {
this.next = next;
}
public boolean isNext() {
return next != 0 ;
}
public void setNext(boolean next) {
if(next) this.next = 1;
else this.next = 0;
}
When hibernate loads up an object of this class I get -
BasicPropertyAccessor - expected type: boolean, actual value java.lang.Integer
.....
....
IllegalArgumentException: argument type mismatch
..... etc..
Why doesn't Hibernate pick up the setNext(int next) method?
John.