-->
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.  [ 2 posts ] 
Author Message
 Post subject: Problem with date column.
PostPosted: Tue Aug 31, 2004 4:01 pm 
Beginner
Beginner

Joined: Fri Nov 28, 2003 11:21 am
Posts: 49
Location: Buenos Aires, Argentina
Hi!, I have a class 'A' with a persistent attribute of type java.sql.Date :
.....
private java.sql.Date fecha;
.....
<property name="fecha" column="A_Fecha" type="date"/>
......
then I do this:
....
A a = new A();
a.setFecha(new java.sql.Date(System.currentTimeMillis()));
session.save(a);
...

When I look the database column always the hours, minutes and seconds are the same "12:00:00 p.m." but I need to differentiate it.
The database column type is "datetime".
Any Help?
Thanks.

[b]Hibernate version:2.1.4[/b]

[b]Mapping documents:[/b]

[b]Code between sessionFactory.openSession() and session.close():[/b]

[b]Full stack trace of any exception that occurs:[/b]

[b]Name and version of the database you are using:Microsoft SQL server 7.0[/b]

[b]Debug level Hibernate log excerpt:[/b]


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 31, 2004 4:33 pm 
Proxool Developer
Proxool Developer

Joined: Tue Aug 26, 2003 10:42 am
Posts: 373
Location: Belgium
Map the property using a timestamp type instead of date.

For your info:
- date Hibernate type maps to a Date (without time)
- time Hibernate type maps to a Time (without date)
- timestamp maps to a datetime


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