ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mayeul MARGUET" <mmarg...@aneo.fr>
Subject Using non-default timezones
Date Mon, 05 Jun 2006 14:30:29 GMT
Subject: Using non-default timezones

Hi!

I'm using iBatis to store and fetch dates and hourly timestamps in and
from an Oracle database.
An sql-map fragment is given below as example.

I need these dates and timestamps to be stored as their UTC values, but
when I insert a date using an iBatis insert statement, the value is
stored using my default timezone (ie: for a GMT-1 default timezone,
01/01/2006 00:00:00 UTC is stored as 12/31/2005 or 12/31/2005 23:00:00).
This is a logical default behaviour, but still not the one I need.


I did find a few sql-map examples around the net suggesting there was an
easy way to handle timezones, but failed both to understand how to use
them and to find a documentation on the subject of dates and timezones
with iBatis.


Is there an official way to do it, which would save me the hassle of
modifying my default timezone or storing my dates and timestamps as
text?
Could you point me to a documentation covering the subject?

Or do you think I am missing something and should investigate towards
some Oracle configuration I'm not aware of?

Thanks!


Here is my sql-map example, kinda straightforward:

	<resultMap id="NameTimestampDate.map"
class="NameTimestampDate.class">
		<result property="name" column="NAME" />
		<result property="timestamp" column="MY_TIMESTAMP" />
		<result property="date" column="MY_DATE" />
	</resultMap>

	<select id="getNameTimestampDateByName"
		resultMap="NameTimestampDate.map"
		parameterClass="java.lang.String">

		<![CDATA[
		SELECT * FROM TEST_TIMESTAMPS
			WHERE NAME = #name#
		]]>		
	</select>

	<insert id="insertNameTimestampDate"
		parameterClass="NameTimestampDate.class">

		<![CDATA[
		INSERT INTO TEST_TIMESTAMPS (NAME, MY_TIMESTAMP,
MY_DATE)
			VALUES (#name#, #timestamp#, #date#)
		]]>		
	</insert>

--
Mayeul


Mime
View raw message