-->
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: Date properties
PostPosted: Sat Jul 03, 2004 3:54 pm 
Newbie

Joined: Thu Feb 12, 2004 9:48 am
Posts: 12
Location: Campina Grande, PB, Brazil
Quote:
Hi, fellas!

I have a bean that I want to be a persistent object. This bean have two properties of type java.util.Date. In the respective mapping, I wrote the following:


Code:
      <property name="beginning" type="date" not-null="true">
         <column name="beginning" sql-type="datetime" not-null="true"/>
      </property>

      <property name="ending" type="date" not-null="true">
         <column name="ending" sql-type="datetime" not-null="true"/>
      </property>



Quote:

I want that information about the time of the day in those Date fields be saved persistently, too. But, apparently, it's not. I'm using MySql database (version 4.0.18) to store data.
When I check the data saved when I save one of my objects with the "beginning" field set to, say, 2004/1/1 13:00:00 and the "ending" field set to, say, 2004/1/1 14:00:00, the database has the values 2004/1/1 00:00:00 and 2004/1/1 00:00:00, respectively.

How can I solve this problem?

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 03, 2004 4:19 pm 
Senior
Senior

Joined: Sun Jan 04, 2004 2:46 pm
Posts: 147
Use type="timestamp" instead. You still use java.util.Date in the java objects.


Top
 Profile  
 
 Post subject: Thanks
PostPosted: Sat Jul 03, 2004 4:41 pm 
Newbie

Joined: Thu Feb 12, 2004 9:48 am
Posts: 12
Location: Campina Grande, PB, Brazil
Quote:
Thanks. It helped a lot.


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.