andres buelo

Greenhorn
+ Follow
since Jan 31, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by andres buelo

thanks for the reply

@Lorand
unfortunately I can't make the DB accept null dates, and my form rejects null dates only under some circumstances, in some cases I have the need to make the form accept it...

@David
thanks for the suggestion, but what other solution can I adopt? I didn't understand if you are telling me to use Hibernate types or not..

Andres
14 years ago
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
14 years ago