On 4/11/06, Rafael Nami <[EMAIL PROTECTED]> wrote:
> when I submit a empty
> inputText, the value passed to the backing bean is the "" value, and this is
> directly impacting in my backend, because I'm using Hibernate Criteria API
> for the search method. Is this "conversion" the right behavior? If it is,
> how can I convert this value to null??

In JSF 1.2, you will be able to register a StringConverter to change
the values from "" to null.

For now, you have to handle this in your backend code.   Not sure how
it's done for Hibernate, but for Cayenne, I have a method that does
this on the BaseDataObject superclass for all of my entity classes.  
There's probably a way to do something similar in Hibernate.

    public void writeProperty(String propName, Object value)
    {
        // Oracle can't handle empty strings, and JSF generates them
instead of nulls.
        if ( (value instanceof String) && (0 == ((String)value).length()) )
            super.writeProperty(propName, null);
        else super.writeProperty(propName, value);
    }

Reply via email to