What is the best suggestion for a mapping file when the domain model contains a boolean value, but it is stored in the database as a single char. This is one of those cases when 'Y' = true and 'N' = false.
So far I have created two methods in my domain model:
Code:
public boolean getValueBoolean() {
return "Y".equals(_value);
}
public void setValueBoolean(boolean value) {
_value = value ? "Y" : "N";
}
private String getValue() {
return _value;
}
private void setValue(String value) {
_value = value;
}
And I map the _value instance variable in my HBM file. Seems like I may be missing something built-in to Hibernate to enable these types of conversions that I haven't come across in the documentation.