hi all,
I'm new to the world of struts 2 and hibernate, I'm working on a little project and I have to following problem. Hope someone can point me to the right direction.
I have a form with some date fields. The db doesn't accept null date but the form (only in some cases) does. I thought the only solution was to provide a "fake date" after submission like this:
1. the user submits form with one or more empty date fields
2. I change those date fields values to something like 9/9/9999 and store this value to the db.
on the other side, if I want to see data from the db>
1. I retrieve the data
2. I check the dates fields for value=9/9/9999 and change it to an empty string
I can only think at 3 solution right now: costumTypeConverter? a prepare() method? or just change the getter/setter on the Pojo ?
Actually I've tried the getter/setter solution, and it works for the view, but pull in some problem with Hibernate session/transaction referencing null values and making updates/insertion fail.
I think this could be a common problem, but with my zero knowledge I don't know if I'm working on the right direction. If this is the right direction I'll go on investigate on Hibernate exception. Do you have any suggestion ?
thanks