-->
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.  [ 5 posts ] 
Author Message
 Post subject: Date is OK, but Time is zero for type date ?
PostPosted: Wed Feb 16, 2005 1:33 am 
Beginner
Beginner

Joined: Wed Feb 16, 2005 1:22 am
Posts: 25
Location: Jakarta
Hi, i really need help here. I use the type date for column named LOGS, hoping that system's date and time will be inserted from myEntity.setLogs(new Date())
The date is inserted successfully by hibernate but the time is set to zero. I've used the latest version of oracle jdbc driver for 9.2.0.1 release, but it still goes like this.

The column type is oracle DATE, the entity uses java.util.Date.

Any help would really be appreciated !
Thanks !

Hibernate version:
2.1

Mapping documents:
<property
name="logs"
type="date"
column="LOGS"
/>

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:
oracle 9.2.0.1

The generated SQL (show_sql=true):
Hibernate: update PERINTAHBAYAR set VERSION=?, TGLPERINTAHBAYAR=?, KODESUPPLIER=?, NILAIPEMBAYARAN=?, FLAGSUDAHKONFIRMAKHIR=?, LOGS=? where NOPERINTAHBAYAR=? and JENISTRANSAKSI=? and VERSION=?

Debug level Hibernate log excerpt:


[/quote]

_________________
Greater in battle
than the man who would conquer
a thousand-thousand men,
is he who would conquer
just one —
himself.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 16, 2005 1:46 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
type="timestamp"


P.S. we would prefer if you spent a leeetle bit more time reading the docs before posting here, thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 16, 2005 2:35 am 
Beginner
Beginner

Joined: Wed Feb 16, 2005 1:22 am
Posts: 25
Location: Jakarta
I changed the SQL column type from DATE to TIMESTAMP.
It works ! Thanks !

But still the type="date" doesnt work. From what i read in hibernate in action, mapping type="date" corresponds with java type java.util.Date and SQL Type DATE, and that's what i really wanted.

Still curious if i miss something important while wading through the book and the reference.

Thanks alot !

_________________
Greater in battle
than the man who would conquer
a thousand-thousand men,
is he who would conquer
just one —
himself.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 16, 2005 2:43 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
No, it corresponds to a java.sql.Date.

And I think you are confused about the semantics of a ANSI SQL DATE type.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 16, 2005 3:52 am 
Beginner
Beginner

Joined: Wed Feb 16, 2005 1:22 am
Posts: 25
Location: Jakarta
Sorry, i thought that ANSI SQL also stores time in DATE type. T_T

Thanks again.

_________________
Greater in battle
than the man who would conquer
a thousand-thousand men,
is he who would conquer
just one —
himself.


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