This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Zero date Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Zero date" Watch "Zero date" New topic

Zero date

Alex Armenteros
Ranch Hand

Joined: May 05, 2010
Posts: 75
My partner for some reason (and he won't change his mind) needs for another program (C++ w/o hibernate) a datetime column with the value "0000-00-00 00:00:00" . is there some way to insert/update that value FROM hibernate?
Martin Vajsar

Joined: Aug 22, 2010
Posts: 3728

I'm afraid he'll have to initiate a calendar reform to achieve that

There are three problems with that date: no day zero exists, no month zero exists, and actually, no year zero exists in the Julian/Gregorian calendar, though the last one is probably not enforced by at least some datetime libraries.

So, that date can be represented neither in the database, nor in a datetime representation in any reasonable language. My opinion is that it is therefore impossible. The only possibility I see is to choose a special value (such as NULL) and represent that value in the user interface as "0000-00-00 00:00:00". Though displaying a "null" or empty field instead would be probably even better.
Alex Armenteros
Ranch Hand

Joined: May 05, 2010
Posts: 75
I already know that but the bad thing is that he is pretty stubborn and won't change his program, We'll try another aproach... Thanks.
I agree. Here's the link:
subject: Zero date
It's not a secret anymore!