You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by David Goodenough <da...@btconnect.com> on 2008/04/03 22:46:01 UTC
Problem with Postgresql TIMESTAMP objects
In my application I am using an @Version field which is a timestamp.
I declare is (in Basic for those following the saga)
@Version @Temporal(TemporalType.TIMESTAMP) private Date version;
(and that is a java.util.Date, not a java.sql.Date).
But when loading the metadata for the classes it says:-
2019 bucksmusic TRACE [main] openjpa.MetaData - Resolving
field "uk.co.dga.bucksmusic.jpa.Role@28360136.version".
2019 bucksmusic TRACE [main] openjpa.MetaData - "version" has mapping
strategy "none".
2020 bucksmusic TRACE [main] openjpa.MetaData - Resolving
field "uk.co.dga.bucksmusic.jpa.Role@28360136.fullName".
2020 bucksmusic TRACE [main] openjpa.MetaData - "fullName" has mapping
strategy "org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
So it has correctly identified fullName as being a String, but for
version the strategy is none, where is should be TimestampVersionStrategy
(I presume).
Is this something I have set up wrong?
If I try changing version to being an int, it works. But I had thought from
the manual that using a Date field was an option?
David
Re: Problem with Postgresql TIMESTAMP objects
Posted by David Goodenough <da...@btconnect.com>.
On Friday 04 April 2008, Brill Pappin wrote:
> Isn't type timestamp a long value?
>
> - Brill Pappin
>
> -----Original Message-----
> From: David Goodenough [mailto:david.goodenough@btconnect.com]
> Sent: Thursday, April 03, 2008 4:46 PM
> To: users@openjpa.apache.org
> Subject: Problem with Postgresql TIMESTAMP objects
>
> In my application I am using an @Version field which is a timestamp.
>
> I declare is (in Basic for those following the saga)
>
> @Version @Temporal(TemporalType.TIMESTAMP) private Date version;
>
> (and that is a java.util.Date, not a java.sql.Date).
>
> But when loading the metadata for the classes it says:-
>
> 2019 bucksmusic TRACE [main] openjpa.MetaData - Resolving
> field "uk.co.dga.bucksmusic.jpa.Role@28360136.version".
> 2019 bucksmusic TRACE [main] openjpa.MetaData - "version" has
> mapping
> strategy "none".
> 2020 bucksmusic TRACE [main] openjpa.MetaData - Resolving
> field "uk.co.dga.bucksmusic.jpa.Role@28360136.fullName".
> 2020 bucksmusic TRACE [main] openjpa.MetaData - "fullName" has
> mapping
> strategy "org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
>
> So it has correctly identified fullName as being a String, but for version
> the strategy is none, where is should be TimestampVersionStrategy (I
> presume).
>
> Is this something I have set up wrong?
>
> If I try changing version to being an int, it works. But I had thought
> from the manual that using a Date field was an option?
>
> David
No, the database schema that OpenJPA creates has an "abstime"
column for this field.
David
RE: Problem with Postgresql TIMESTAMP objects
Posted by Brill Pappin <br...@pappin.ca>.
Isn't type timestamp a long value?
- Brill Pappin
-----Original Message-----
From: David Goodenough [mailto:david.goodenough@btconnect.com]
Sent: Thursday, April 03, 2008 4:46 PM
To: users@openjpa.apache.org
Subject: Problem with Postgresql TIMESTAMP objects
In my application I am using an @Version field which is a timestamp.
I declare is (in Basic for those following the saga)
@Version @Temporal(TemporalType.TIMESTAMP) private Date version;
(and that is a java.util.Date, not a java.sql.Date).
But when loading the metadata for the classes it says:-
2019 bucksmusic TRACE [main] openjpa.MetaData - Resolving
field "uk.co.dga.bucksmusic.jpa.Role@28360136.version".
2019 bucksmusic TRACE [main] openjpa.MetaData - "version" has
mapping
strategy "none".
2020 bucksmusic TRACE [main] openjpa.MetaData - Resolving
field "uk.co.dga.bucksmusic.jpa.Role@28360136.fullName".
2020 bucksmusic TRACE [main] openjpa.MetaData - "fullName" has
mapping
strategy "org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
So it has correctly identified fullName as being a String, but for version
the strategy is none, where is should be TimestampVersionStrategy (I
presume).
Is this something I have set up wrong?
If I try changing version to being an int, it works. But I had thought from
the manual that using a Date field was an option?
David