Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hibernate : Generic JDBC exception - Bad format for Time '838:59:59'

I have hibernate mapping as follow:

<property formula="(Timediff(ifnull(sttime,now()),sstime))" insert="false" name="duration" update="false" />
where sstime is of type Timestamp

here this formula returns some value in this format "838:59:59" from my data.

I got the exception when i am trying to load this value in 'Duration' field, which has 'java.sql.Time' type, it gives me this exception.

"Generic JDBC exception - Bad format for Time '838:59:59'"
like image 269
Haresh Godhani Avatar asked Mar 12 '13 11:03

Haresh Godhani


1 Answers

That's indeed not a valid time. You should not use a java.sql.Time to represent a duration, especially if this duration is potential longer tha 24 hours, since a Time represents the time portion of a date. Use a custom type instead, or simply a string that you'll parse yourself.

like image 110
JB Nizet Avatar answered Sep 23 '22 13:09

JB Nizet