-->
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.  [ 9 posts ] 
Author Message
 Post subject: Saving full date object save only the date without the time?
PostPosted: Thu Mar 03, 2005 12:49 pm 
Newbie

Joined: Thu Dec 23, 2004 3:53 am
Posts: 19
Hibernate version:
2.1

Name and version of the database you are using:
Oracle 9

Hi all.

Thank you for your time.
I'm using Hibernate through Spring framework.

I have a problem saving a date object, it only save the date and ignore the time can any one help, or give a hint where to look for?

There is no error, it just ignore the time...

Thanks

Oded


Top
 Profile  
 
 Post subject: Re: Saving full date object save only the date without the t
PostPosted: Thu Mar 03, 2005 1:25 pm 
Regular
Regular

Joined: Tue Jan 11, 2005 8:55 pm
Posts: 53
shushu wrote:
Hibernate version:
2.1

Name and version of the database you are using:
Oracle 9

Hi all.

Thank you for your time.
I'm using Hibernate through Spring framework.

I have a problem saving a date object, it only save the date and ignore the time can any one help, or give a hint where to look for?

There is no error, it just ignore the time...

Thanks

Oded


Try using a Calendar object instead. I'm using an Oracle 9 database as well with a Calendar object, and it works fine.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 04, 2005 4:04 am 
Newbie

Joined: Mon Feb 28, 2005 12:53 pm
Posts: 18
Use Timestamp instead of Date.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 04, 2005 11:46 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
See the basic types
http://www.hibernate.org/hib_docs/reference/en/html/mapping.html#mapping-types


Top
 Profile  
 
 Post subject: Saving full date object save only the date without the time?
PostPosted: Sun Mar 06, 2005 3:54 am 
Newbie

Joined: Thu Dec 23, 2004 3:53 am
Posts: 19
10x for all the replies.

But none of this helps, its seems that I'm missing something in the configuration of hibernate/spring (I think).

My code looks like this:

HBM file:
Code:
<class name="DateTest" table="DateTest">
<!-- Primary key -->
        <id name="id" column="ID" type="long" access="property" unsaved-value="-1">
            <generator class="native"/>
        </id>
      <property name="creationDate" column="CREATION_DATE" access="property" type="date"/>
</class>


Presistent class:
The field is private Date with getter and a Setter in its Parent class.
At first the field was timestamp but changed to date in order to try it that way but still did not work.

And the test code:

Code:
Session session = getSession (); //get the session from Spring framework
DateTest dt = new DateTest ();
dt.setCreationDate (Calendar.getInstance ().getTime ());

session.save (dt);



p.s.

I tried timestamp, date, and calendar it still no hope, Am I missing something?

10x again..

Oded


Top
 Profile  
 
 Post subject: Can it be a driver issue?
PostPosted: Sun Mar 06, 2005 5:15 am 
Newbie

Joined: Thu Dec 23, 2004 3:53 am
Posts: 19
I'm using Oracle thin driver, from the ojdbc14.jar

10x


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 07, 2005 6:42 am 
Newbie

Joined: Mon Feb 28, 2005 12:53 pm
Posts: 18
<property
name="creationDate"
type="java.sql.Timestamp"
column="CREATION_DATE"
/>


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 07, 2005 7:15 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
There were some issue with Date with certain Oracle JDBC drivers. Use the latest driver.


Top
 Profile  
 
 Post subject: It's solved
PostPosted: Tue Mar 08, 2005 4:06 am 
Newbie

Joined: Thu Dec 23, 2004 3:53 am
Posts: 19
Thanks for the replies, I solved the problem.

It was like some of you said a problem of driver.

So now I'm using the jdbc driver from Oracle version 9.2.0.1 instead of the 10g driver.

And the 'timestamp' type in the HBM file.

Thanks again.

Oded Hassidi


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