-->
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: Date mapping issue with Oracle 10
PostPosted: Thu Jul 15, 2004 5:55 pm 
Newbie

Joined: Thu Jul 15, 2004 5:37 pm
Posts: 1
I'm seeing a weird issue with Hibernate 2.1.4/Oracle 10.

I have a java.util.Date mapped to an Oracle DATE.

In a unit test I have, I create an object, then persist to database. I then load the associated record into another object, and compare each attribute for equality.

The date, as you might expect, has millisecond granularity that a java.util.Date doesn't have, so the compare fails. But, for fun, I altered my assertion message to also print out the class name of the attribute... So, for the object that I saved to DB, the attribute in question is java.util.Date. No surprise. But, for the object I load back, it's a java.sql.Timestamp?!?

User originalUser = new User();
// populate attributes in originalUser
dao.save( originalUser );

User reloadedUser = dao.load ( anId );

// originalUser.dateColumn.class.toString() !=
// reloadedUser.dateColumn.class.toString() ?!?

I appreciate dates not comparing due to mllisecond rounding, etc., but I now have a User object with a different attribute type than another User object. That seems very disconcerting...

_________________
Bryan Headley
The Ticket Reserve


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.