[Solved] java.sql.SQLException - Zero date value prohibited - Texient - Learn 'n Share

Texient - Learn 'n Share

News & Articles on Technology, Finance & Marketing

Breaking

Home Top Ad

Sunday, 18 September 2016

[Solved] java.sql.SQLException - Zero date value prohibited

Recently while working on a Java + Spring + Hibernate + MySQL project I encountered a weird exception "java.sql.SQLException: Zero date value prohibited"!


As usual I did a quick search on Google but to my surprise Google did not return any result!

First I was scared, thought troubleshooting would be difficult. Upon closed analysis of the issue, this came out to be a silly data issue!


org.springframework.dao.TransientDataAccessResourceException: Hibernate operation: could not execute query; SQL [select field1, field2, field3 from table1]; Zero date value prohibited; nested exception is java.sql.SQLException: Zero date value prohibited.

I had a date column where the entries were '0000-00-00', just nullified the entries and the error went away!

No comments:

Post a Comment

Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to our feed and get articles like this delivered automatically to your feed reader? Like our Facebook Page.