-->
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.  [ 2 posts ] 
Author Message
 Post subject: problem with "zero day dates"
PostPosted: Wed Jul 16, 2008 6:56 am 
Newbie

Joined: Wed Jul 16, 2008 6:40 am
Posts: 1
Hi all!

I am connecting my app to a legacy mysql DB for reading only, all mappings work fine but I have the following problem:
The db contains several columns with "zero day dates", e.g. 2007-06-00 and I want this to be reflected in my object as june 2007
Now it reads in as 2007-05-31 00:00:00.0 .

I tried the LifeCycle interface method onLoad, but at this point the value has already be read in wrong.

Do you have any ideas where to tweak my configs/mappings/sources ?

btw.: I cannot change the content or schema of the db, and I have to read from it continuously and it will contain these mad dates again and again as the apps producing them are still in use.

Any ideas?

TIA and kind regards

Michael


Top
 Profile  
 
 Post subject: Solution
PostPosted: Wed Jul 16, 2008 11:16 am 
Newbie

Joined: Wed Jul 16, 2008 11:07 am
Posts: 1
hy michael,

one solution to the given problem is, to
use noDatetimeStringSync=true in the jdbc connection url [ be carefull to use & in hibernate.cfg.xml if you're using another urlparam in the connection url ]
and to map the datetime field of mysql-database again using another name, type=string and insert=false and update=false but the same columnname in the mapping.xml.

so that you at least have

getDatefield() = 31.05.07
getDatefieldString() = 00.06.07

thanks to http://swik.net/MySQL/Mark+Matthew who posted the hint nearly exactly one year ago

wkr j


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

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.