Hi all
Here’s a cut-down version of a problem I’m having with the populate() function.
Firstly, the framework:
I have a PersonService that extends coldbox.system.orm.hibernate.VirtualEntityService.
PersonService works with the entity called ‘Person’.
‘Person’ sits on the database table T_PERSON.
T_PERSON has a column ALERTS_EMAIL_PECO_KY (number) nullable=yes
Then I have this code:
var person = PersonService.populate(
target=accreditation.attr(‘T_PERSON’),
memento={
TITLE_FREE_LB = event.getValue(‘TITLE_FREE_LB’, ‘’)
, LAST_NAME_UN_LB = event.getValue(‘LAST_NAME_UN_LB’, ‘’)
, FIRST_NAME_UN_LB = event.getValue(‘FIRST_NAME_UN_LB’, ‘’)
, ALERTS_EMAIL_PECO_KY = 2
}
, nullEmptyInclude=‘ALERTS_EMAIL_PECO_KY’
);
PersonService.save(person);
This populates the ALERTS_EMAIL_PECO_KY with 2. No problem.
However, if I change the value of ALERTS_EMAIL_PECO_KY to either an empty string or null or javacast null, I get the following error:
Error populating bean app.model.Person with argument ALERTS_EMAIL_PECO_KY of type class java.lang.String.
Simple values are booleans, numbers, strings, and date-time values. The value cannot be converted to a numeric because it is not a simple value.
Are empty strings and nulls not simple values??
And why is it demanding a numeric when nulls are allowed? The property in the model looks like this:
property name=“ALERTS_EMAIL_PECO_KY” column=“ALERTS_EMAIL_PECO_KY” type=“numeric” ormtype=“integer” default="";
I’ve probably missed something really simple but this is driving me nuts. Can anyone see what’s wrong?