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.  [ 4 posts ] 
Author Message
 Post subject: version timestamp is only to tenths of a second
PostPosted: Sat Aug 21, 2004 4:09 pm 
Senior
Senior

Joined: Sat Jul 17, 2004 5:16 pm
Posts: 143
When I use timestamp(6) Oracle column type in 9i, Hibernate only uses tenths of a second (it appears). This is a generated query:

Code:
insert into hib_member (last_updated, penn_id, last_name, is_student, some_number, some_date, member_id) values ('2004-08-21 15:43:[b]03.3[/b]', 13622843, 'Jones', 'true', 123.456, '2001-03-02', 1188)


Is there a configuration for Hibernate (or Java if that is where the issue is, I assume its not the driver, though could be there too) where we can use a more specific timestamp? We want a trigger on our table to see if the query is updating the timestamp, and if not, set it to the current timestamp. However, since Hibernate is only to tenths of a second, successive queries are getting changed by the trigger, and then Hibernate is unhappy:

Code:
Problem closing session: null, net.sf.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) for edu.upenn.isc.fast.beans.plsql.PersonArray instance with identifier: 1188


I know I could use an integer intead of timestamp for versioning, but timestamps seem more useful (as long as they work).

Thanks!
Chris


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 21, 2004 4:22 pm 
Senior
Senior

Joined: Sat Jul 17, 2004 5:16 pm
Posts: 143
Whoops, I figured this out (thanks for not yelling about my not posting my code :) ), I think the type of the java property wasnt a Timestamp... Now it seems to be doing what I need now that it is Timestamp, so far so good. Chris


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 21, 2004 5:19 pm 
Senior
Senior

Joined: Sat Jul 17, 2004 5:16 pm
Posts: 143
I take that back. :) Disregard my last post, I thought when I had changed my object hierarchy something happened, but it didnt.

When I debug, and stop at TimestampType.toString(), I see the timestamp has millis:

2004-08-21 17:14:30.685

However, in my DB trigger, I log the changes, and it is only getting a specificity of seconds:

old( 08/21/2004 16:55:39:000000) = new (08/21/2004 16:55:39:000000) for member id: 1229

Also, if I look at inserts from Hibernate, I see values truncated to seconds.

When I insert from SQLPlus, it works fine (and stores the millis), and the trigger works fine. The DB column type is Timestamp(6).

So now I assume this is a DB driver problem. I am using a Oracle 9i thin driver. Any ideas?

Thanks,
Chris


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 21, 2004 5:32 pm 
Senior
Senior

Joined: Sat Jul 17, 2004 5:16 pm
Posts: 143
Sorry for so many posts. I downloaded the latest 9i Java 1.4 driver (ojdbc14.jar) from:

http://www.oracle.com/technology/softwa ... c9201.html

And now, finally, millis are going to the DB... Phew!

Thanks for listening,

Chris


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