You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Raul Acevedo <ra...@cantara.com> on 2007/12/28 03:22:33 UTC

using timestamp with time zone

Can Torque work with timestamp with time zone columns?  I have two
problems:

1.  Torque's XML mapping DTD doesn't allow "timestamp with time zone",
only "timestamp".

2.  If I change the column type in the database, Torque always reads
null from that column.

Is it possible for this to work?  Many thanks,

Raul Acevedo
http://www.cantara.com



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Re: using timestamp with time zone

Posted by Fran Ferri <fr...@gmail.com>.
TORQUE 3 is genetarting for SQL Server the date in the format: '20070130
00:00:00' but SQL Server 2005 is not working with this format. Is posible
change the output date format in TORQUE?

2008/1/4, Raul Acevedo <ra...@cantara.com>:
>
> If I didn't need to do this I wouldn't be asking.  :)
>
> I was hoping to avoid overriding/adding methods to do a conversion, the
> whole point is to have Torque handle this automatically.
>
> Raul
>
> On Wed, 2008-01-02 at 16:34 -0500, Greg Monroe wrote:
> > Some quick research on this indicated that this seems
> > to be a problem with the JDBC Timestamp API which does
> > not allow for the TimeZone part of the SQL data.  My
> > guess is that JDBC drivers for SQL servers that support
> > this column type convert this into the correct GMT
> > time representation or supply a JDBC specific object
> > to support this.
> >
> > Of course, this problem is compounded by the fact that
> > there is a LOT of variations of how different DB engines
> > (and version of them) support this column.
> >
> > That said, there may be a couple of ways to deal with
> > your problem in a local manner.
> >
> > First, do you REALLY need that type of column?  Timezone
> > is really a display issue and not a storage one.  A date
> > inserted into a DB Timestamp column using a Java Date object
> > that has been created using Timezone parsing will be the
> > correct time if it is displayed with any associated TimeZone
> > setting.
> >
> > If you really need this, then you might look at using a
> > VARCHAR setting in the XML with the underlying DB manually
> > set to TIMESTAMP WITH TIMEZONE.  This should return your
> > JDBC's <ColumnObject>.toString() representation.  You can
> > then locally override/add your own methods for converting
> > too and from a Java date object via the String representation.
> >
> >
> >
> >
> >
> > > -----Original Message-----
> > > From: Raul Acevedo [mailto:raul@cantara.com]
> > > Sent: Thursday, December 27, 2007 9:23 PM
> > > To: torque-user@db.apache.org
> > > Subject: using timestamp with time zone
> > >
> > > Can Torque work with timestamp with time zone columns?  I have two
> > > problems:
> > >
> > > 1.  Torque's XML mapping DTD doesn't allow "timestamp with
> > > time zone", only "timestamp".
> > >
> > > 2.  If I change the column type in the database, Torque
> > > always reads null from that column.
> > >
> > > Is it possible for this to work?  Many thanks,
> > >
> > > Raul Acevedo
> > > http://www.cantara.com
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> > > For additional commands, e-mail: torque-user-help@db.apache.org
> > >
> > >
> > DukeCE Privacy Statement:
> > Please be advised that this e-mail and any files transmitted with
> > it are confidential communication or may otherwise be privileged or
> > confidential and are intended solely for the individual or entity
> > to whom they are addressed. If you are not the intended recipient
> > you may not rely on the contents of this email or any attachments,
> > and we ask that you please not read, copy or retransmit this
> > communication, but reply to the sender and destroy the email, its
> > contents, and all copies thereof immediately. Any unauthorized
> > dissemination, distribution or copying of this communication is
> > strictly prohibited.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: torque-user-help@db.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>
>

RE: using timestamp with time zone

Posted by Raul Acevedo <ra...@cantara.com>.
If I didn't need to do this I wouldn't be asking.  :)

I was hoping to avoid overriding/adding methods to do a conversion, the
whole point is to have Torque handle this automatically.

Raul

On Wed, 2008-01-02 at 16:34 -0500, Greg Monroe wrote:
> Some quick research on this indicated that this seems
> to be a problem with the JDBC Timestamp API which does
> not allow for the TimeZone part of the SQL data.  My
> guess is that JDBC drivers for SQL servers that support
> this column type convert this into the correct GMT 
> time representation or supply a JDBC specific object
> to support this.
> 
> Of course, this problem is compounded by the fact that
> there is a LOT of variations of how different DB engines
> (and version of them) support this column.
> 
> That said, there may be a couple of ways to deal with 
> your problem in a local manner.
> 
> First, do you REALLY need that type of column?  Timezone
> is really a display issue and not a storage one.  A date 
> inserted into a DB Timestamp column using a Java Date object 
> that has been created using Timezone parsing will be the
> correct time if it is displayed with any associated TimeZone
> setting.
> 
> If you really need this, then you might look at using a 
> VARCHAR setting in the XML with the underlying DB manually
> set to TIMESTAMP WITH TIMEZONE.  This should return your
> JDBC's <ColumnObject>.toString() representation.  You can 
> then locally override/add your own methods for converting 
> too and from a Java date object via the String representation.
> 
> 
> 
> 
> 
> > -----Original Message-----
> > From: Raul Acevedo [mailto:raul@cantara.com] 
> > Sent: Thursday, December 27, 2007 9:23 PM
> > To: torque-user@db.apache.org
> > Subject: using timestamp with time zone
> > 
> > Can Torque work with timestamp with time zone columns?  I have two
> > problems:
> > 
> > 1.  Torque's XML mapping DTD doesn't allow "timestamp with 
> > time zone", only "timestamp".
> > 
> > 2.  If I change the column type in the database, Torque 
> > always reads null from that column.
> > 
> > Is it possible for this to work?  Many thanks,
> > 
> > Raul Acevedo
> > http://www.cantara.com
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: torque-user-help@db.apache.org
> > 
> > 
> DukeCE Privacy Statement:
> Please be advised that this e-mail and any files transmitted with
> it are confidential communication or may otherwise be privileged or
> confidential and are intended solely for the individual or entity
> to whom they are addressed. If you are not the intended recipient
> you may not rely on the contents of this email or any attachments,
> and we ask that you please not read, copy or retransmit this
> communication, but reply to the sender and destroy the email, its
> contents, and all copies thereof immediately. Any unauthorized
> dissemination, distribution or copying of this communication is
> strictly prohibited.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


RE: using timestamp with time zone

Posted by Greg Monroe <Gr...@DukeCE.com>.
Some quick research on this indicated that this seems
to be a problem with the JDBC Timestamp API which does
not allow for the TimeZone part of the SQL data.  My
guess is that JDBC drivers for SQL servers that support
this column type convert this into the correct GMT 
time representation or supply a JDBC specific object
to support this.

Of course, this problem is compounded by the fact that
there is a LOT of variations of how different DB engines
(and version of them) support this column.

That said, there may be a couple of ways to deal with 
your problem in a local manner.

First, do you REALLY need that type of column?  Timezone
is really a display issue and not a storage one.  A date 
inserted into a DB Timestamp column using a Java Date object 
that has been created using Timezone parsing will be the
correct time if it is displayed with any associated TimeZone
setting.

If you really need this, then you might look at using a 
VARCHAR setting in the XML with the underlying DB manually
set to TIMESTAMP WITH TIMEZONE.  This should return your
JDBC's <ColumnObject>.toString() representation.  You can 
then locally override/add your own methods for converting 
too and from a Java date object via the String representation.





> -----Original Message-----
> From: Raul Acevedo [mailto:raul@cantara.com] 
> Sent: Thursday, December 27, 2007 9:23 PM
> To: torque-user@db.apache.org
> Subject: using timestamp with time zone
> 
> Can Torque work with timestamp with time zone columns?  I have two
> problems:
> 
> 1.  Torque's XML mapping DTD doesn't allow "timestamp with 
> time zone", only "timestamp".
> 
> 2.  If I change the column type in the database, Torque 
> always reads null from that column.
> 
> Is it possible for this to work?  Many thanks,
> 
> Raul Acevedo
> http://www.cantara.com
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
> 
> 
DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org