This content has been marked as final.
Show 5 replies
-
1. Re: inputText / empty string versus NULL
trickyvail Sep 13, 2007 11:38 AM (in response to toni)I'm not certain this will work but please try and post results.
Inside your entity bean change the setter method for the field you want to be null to something like this:public void setField(String field) { if("".equals(field)) { this.field = null; } else { this.field = field; } }
-
2. Re: inputText / empty string versus NULL
supernovasoftware.com Sep 13, 2007 11:52 AM (in response to toni)How about using a converter that trims the field and if field.trim().equals("") use null.
-
3. Re: inputText / empty string versus NULL
goku2 Sep 13, 2007 12:00 PM (in response to toni)Try this
public void setField(String field) { if(field == null) { this.field = null; } else { if("".equals(field.trim())) { this.field = field; } else { //you could trim before asignement too. this.field = field; } } }
To eliminate multiple spaces. -
4. Re: inputText / empty string versus NULL
matt.drees Sep 13, 2007 12:18 PM (in response to toni)Haven't tried it, but found this while googling around (a more detailed version of what Jason is suggesting):
http://jroller.com/stritti/entry/jsf_stringconverter_for_null_values
I'd recommend not trying to solve this in your domain model. Tedious and ugly. -
5. Re: inputText / empty string versus NULL
toni Sep 14, 2007 2:23 AM (in response to toni)Thanks Matt