mtreen
2009-09-08 17:16:47 UTC
This is probably a simple question. I've looked everywhere I can think of for the answer:
A Mysql column that is defined as boolean or tinyint(1) can only have 2 values, 0 or 1. This column is bound to a checkbox.
When a new record is created in a toplink environment and that record contains a boolean field, the only way I can see to prevent a null exception is to modify the generated entity and have each boolean column explicitly look for null and then set the boolean to false:
public Boolean getReportselection() {
if (reportselection == null) reportselection = false;
return reportselection;
}
If I do not include the if (.....) .... = false in the entity then the form creation fails.
Showing my entity ignorance, is there any way to automatically have the boolean nulls return a false or does each field have to be explicitly dealt with?
------------------------
Lost in North Africa
A Mysql column that is defined as boolean or tinyint(1) can only have 2 values, 0 or 1. This column is bound to a checkbox.
When a new record is created in a toplink environment and that record contains a boolean field, the only way I can see to prevent a null exception is to modify the generated entity and have each boolean column explicitly look for null and then set the boolean to false:
public Boolean getReportselection() {
if (reportselection == null) reportselection = false;
return reportselection;
}
If I do not include the if (.....) .... = false in the entity then the form creation fails.
Showing my entity ignorance, is there any way to automatically have the boolean nulls return a false or does each field have to be explicitly dealt with?
------------------------
Lost in North Africa