File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Zero date" Watch "Zero date" New topic
Author

Zero date

Alex Armenteros
Ranch Hand

Joined: May 05, 2010
Posts: 73
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
Sheriff

Joined: Aug 22, 2010
Posts: 3610
    
  60

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: 73
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Zero date