Change it to Integer in the domain class.
Burt
>
> Please check the following code:
>
> <g:select id="period" name="period" optionKey="key" optionValue="value"
> from="[[key:0,value:'Please choose'],[key:'1',value:'everyday']]"
> value="${remindInstance?.period}" ></g:select>
>
> I want to save NULL to database when user didn't choose peroid, as you can
> see,the default value is 0,
> In controller I add this code:
>
> if(Integer.parseInt(params.period)==0){
> params.period=null
> }
> but I can't save, the error msseage is :
>
> Failed to convert property value of type [null] to required type [int] for
> property period; nested exception is java.lang.IllegalArgumentException:
> Cannot convert value of type [null] to required type [int] for property
> period: PropertyEditor
> [org.springframework.beans.propertyeditors.CustomNumberEditor] returned
> inappropriate value
>
> In database this column is nullable.
>
> Any suggestion?
> Thank you.
>