Thanks Mike, I've done a workaround quite similar using Reflection on my DAO base class to populate a Criteria Object with my filter. I think there's a more elegant way to do this using Hibernate's PropertyResolver, but I'll switch to this in the next refactoring.
Best Regards
Rafael Mauricio Nami
2006/4/11, Mike Kienenberger <[EMAIL PROTECTED]>:
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);
}

