-->
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.  [ 6 posts ] 
Author Message
 Post subject: Legacy date storage. How?
PostPosted: Wed Aug 11, 2004 7:11 am 
Newbie

Joined: Wed Aug 11, 2004 7:01 am
Posts: 10
Hibernate version: 2.1.6
Name and version of the database you are using: Mysql

I have a Legacy database where the dates are stored in varchar(15) fields and as a Long value (eg seconds from 1970-01-01 00:00:00).

'001084109924846' is the representation of 2004-05-09 16:15 (YYYY-MM-DD HH:mm)

Can I make hibernate map this field to a Date field? If so, how?

Regards
Kristoffer


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 11, 2004 7:23 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Use a custom UserType. should be trivial.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 11, 2004 7:24 am 
Expert
Expert

Joined: Thu Jan 29, 2004 2:31 am
Posts: 362
Location: Switzerland, Bern
You can create a UserType. See http://www.hibernate.org/189.html for a similar problem.

HTH
Ernst


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 11, 2004 7:24 am 
Expert
Expert

Joined: Fri Feb 06, 2004 7:49 am
Posts: 255
Location: Moscow, Russia
Custom type (UserType) will help you.
http://www.hibernate.org/?cmd=srchdoc&q=UserType

_________________
Leonid Shlyapnikov


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 11, 2004 7:26 am 
Expert
Expert

Joined: Fri Feb 06, 2004 7:49 am
Posts: 255
Location: Moscow, Russia
Triple shot :)

_________________
Leonid Shlyapnikov


Top
 Profile  
 
 Post subject: Thanks!
PostPosted: Wed Aug 11, 2004 8:17 am 
Newbie

Joined: Wed Aug 11, 2004 7:01 am
Posts: 10
Thanks for getting me on the right track.

/Kristoffer


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.