openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Drew Lethbridge <d...@bund.com.au>
Subject Re: java.util.Data mapping to abstime (deprecated) in postgres
Date Fri, 02 May 2008 04:12:34 GMT
Hi Daniel.  I also had your problem and fixed it by implementing my  
own DBDictionary (subclass of PostgresDictionary) and plugging it in  
using the kodo.jdbc.DBDictionary configuration setting...  Below is an  
sample of my dbdictionary which might be helpful...

cheers!

.droo.

public class MyPostgresDictionary extends PostgresDictionary
{
     private static final String TIMESTAMPTYPENAME = "timestamp";

     /**
      * return the Database type for the given Java type.
      * When using postgres 8, map java.util.Date type to postgres  
TIMESTAMP column type,
      * instead of the Kodo PostgresDictionary default, which is  
ABSTIME.  ABSTIME cannot
      * represent dates beyond 19/01/2038.  if the type parameter does  
not specify a a Date,
      * then the default PostgresDictionary behaviour applies.
      */
     @Override
     public String getTypeName(int type)
     {
         if (type == Types.TIMESTAMP)
         {
             return TIMESTAMPTYPENAME;
         }
         else
         {
             return super.getTypeName(type);
         }
     }

//...

}

On 02/05/2008, at 1:56 PM, Yazbek, Daniel (Daniel) wrote:

> Hi all,
>
>
>
> I am using BEA Weblogic 10, which implements persistence by using kodo
> and openjpa.
>
> I have set this up to persist to a Postgres 8.3 Database.
>
> I have a java.util.Date that I want as a column in a table.
>
> When I run the mapping tool, it maps the java.util.Data datatype to
> Postgres datatype "abstime". However, this datatype is deprecated, and
> should be mapping to "timestamp without time zone" instead.
>
> Has anyone had any success in mapping this properly?
>
> Perhaps I should raise a bug against openjpa?
>
> Thanks
>
> | Daniel Yazbek | Avaya Labs Australia | 123 Epping Road | North Ryde
> 2113 | Australia | +61-2-9352-8615 | dyazbek@avaya.com
> <mailto:dyazbek@avaya.com>  |


Mime
View raw message