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: java.sql.Timestamp mapped to "TIMESTAMP W/L/T/Z" 1
PostPosted: Thu Feb 15, 2007 5:50 pm 
Regular
Regular

Joined: Mon Aug 07, 2006 6:22 pm
Posts: 67
Hibernate 3.0.5, JDK 1.4.2, WebLogic 8.1.4, Oracle 9i.

I have a column of type "TIMESTAMP WITH LOCAL TIME ZONE". I'm mapping that to "java.sql.Timestamp" with Hibernate.

I have a dbinit script that creates this data. After I run the init, I view the data with SQLDeveloper, and the value appears to be ok. In SQLDeveloper, it shows what appears to be my current time. All through this, I'm refreshing the view in SQLDeveloper, and it looks fine all the time.

My app running in WebLogic with Hibernate reads this value, but it does not write it. My app is a message router, and it will read this column every time a message is received.

I set a breakpoint on the "set" method of the POJO mapped in Hibernate, and then I queued up several identical messages to process. When it hits the breakpoint, I view the value of the Timestamp object.

What I'm seeing is that the first time it hits the breakpoint, the "Timestamp.toString()" shows the same value that I see in SQLDeveloper, and my code that uses the value works fine. However, the next two times (each corresponding to a single input message to the message router) I hit the breakpoint, the value it is getting is exactly 1 hour plus the correct value. When my code uses this value, it thinks a bunch of other things need to be reloaded, so it loads lots of other tables from the database.

After getting the wrong value twice, it then reverts back to getting the correct value, and then continues the cycle. I don't know whether the sequence of 1 good and 2 bad is due to timing (because the two bad ones cause reload of data from other tables), or some other race condition.


Top
 Profile  
 
 Post subject: Apparently not a problem with Hibernate
PostPosted: Fri Feb 16, 2007 5:21 pm 
Regular
Regular

Joined: Mon Aug 07, 2006 6:22 pm
Posts: 67
I stepped into the Hibernate code, at the point where it retrieves the value from the ResultSet, and the value is wrong at that point, so I guess I can conclude that this is not an issue with Hibernate. I'll pursue this with BEA, as they provide the Oracle database driver that I'm using ("TIMESTAMP WITH LOCAL TIME ZONE" requires conversion by the database driver).


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.