These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Using databes default values .. some issues
PostPosted: Wed Nov 05, 2008 8:10 am 
Beginner
Beginner

Joined: Thu Oct 04, 2007 12:22 pm
Posts: 48
Via annotations I want to map a Java Timestamp to a MySql timestamp (default mapping). This timestamp may be not null, but therefore gets a default value of (0000-000 ...) to indicate, that no time has been set.
A problem ist the subtle difference between the two Timestamp implementations:
The java Timestamp counts from 1970-1-1, but the MySql one defaults to my intended "0000-00...". So I am not able to set a zero time value to the Java datatype. My thought is to write the zero date via the default datatype within the database. But in a case of saving the corresponding object like this:

Code:
session.save(myTimestampWrapperObject);


I see no chance of triggering the default value of the database. Within MySql the timestamp value would be left blank to indicate that the default should be used. How can I achive this in my code?

Hibernate version:
3.3
Name and version of the database you are using:
MySql 5.1.11


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.