-
1. Re: Mapping between form field and database fields
hstang Dec 21, 2006 1:14 AM (in response to chrismalan)Hi,
If the POJO is an entity (annotated with @Entity), then create the date field like @Temporal(DATE) private Date date
Do you already have this? -
2. Re: Mapping between form field and database fields
pmuir Dec 21, 2006 10:36 AM (in response to chrismalan)I would go for a some transient fields for day,month, year, and make the getters and setters call a updateDate() function which attempts to alter the date field based on the current day/month/year fields.
Or, perhaps build a custom JSF component.
IMO though you would be better with one date (jsf) field and one of the available date selectors (there is one in Seam, Trinidad, Tomahawk, IceFaces...) -
3. Re: Mapping between form field and database fields
chrismalan Dec 21, 2006 7:22 PM (in response to chrismalan)Thanks for the replies. I thought about three fields because there are so many ways to enter dates; 2006-12-22, 22/12/06, 22-12-2006, etc. Of course, with the examples given one can find the right date in some instances. 6-9-06 is harder to figure out. Each field clearly labeled as day, month or year is nearly foolproof.
Of course, a date selector will also achieve that. Although it seems like using a sledgehammer to crack a nut.
Thanks again, -
4. Re: Mapping between form field and database fields
pmuir Dec 22, 2006 4:41 AM (in response to chrismalan)or of course you could reinvent the wheel :p N.B. Most o f the date selectors will include a converter and a validator to check/convert the date from the random-user-format to your desired format.
-
5. Re: Mapping between form field and database fields
gavin.king Jan 8, 2007 12:49 PM (in response to chrismalan)Seam now has s:selectDate. Use that.