-->
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/TIME loss
PostPosted: Sat Dec 29, 2012 5:13 am 
Newbie

Joined: Wed Jun 27, 2012 10:49 am
Posts: 3
Hello,

I am having problems mapping date and time entity attributes with JPA and Oracle 11.

If I give an entity attribute a DATE temporal type, store an instance of the entity in an Oracle 11 database, and retrieve it, I loose the attribute's time part

@Temporal(TemporalType.DATE)
private Date myDateAndTime; // eg, 2012-12-31 00:00:00 instead of, say, 2012-12-31 23:59:59

If, on the other hand, I give the attribute a TIME temporal type, I loose the attribute's date part

@Temporal(TemporalType.TIME)
private Date myDateAndTime; // eg, 1970-01-01 23:59:59

By the way, the MYDATEANDTIME column in my Oracle 11 database is of type DATE.

Some people on the Web suggest changing the database column's type to TIMESTAMP.

Is this the best solution to solving this date-or-time loss issue, or is there a better one?

Many thanks.

Philroc


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.