-->
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.  [ 3 posts ] 
Author Message
 Post subject: My DB stores dates as numerics...what to do when = 0?
PostPosted: Thu Jan 10, 2008 11:50 am 
Newbie

Joined: Wed Jul 05, 2006 9:28 am
Posts: 10
Hibernate version:
3.1.3

In my database, date fields are often stored as seven-digit numeric fields, in the format CYYMMDD. I have created a UserType to map these numeric fields to a java.util.Date.

My problem is this: in my NullSafeGet() method, the value retrieved from the DB for these numeric date fields will sometimes be "0". Since java.util.Date doesn't really offer a way to represent a blank date, I can choose to return null from the method, but that means that every time I use this UserType in my Java code, I'll have to check that the reference isn't null.

Does anyone know of a better way to handle this?

Thanks,
Curt


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 21, 2008 10:07 am 
Newbie

Joined: Wed Jul 05, 2006 9:28 am
Posts: 10
Sorry to bump this, but does anyone have any thoughts on how to better handle this situation?

Thanks,
Curt


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 21, 2008 10:08 am 
Newbie

Joined: Wed Jul 05, 2006 9:28 am
Posts: 10
Sorry to bump this, but does anyone have any thoughts on how to better handle this situation?

Thanks,
Curt


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