openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lukas Ruetz <lukas.ru...@gmx.at>
Subject How to set the type of the DB-field using @Externalizer
Date Tue, 10 Apr 2007 14:21:29 GMT
Hello list!

I'm trying to use the @Externalizer annotation but have problems
with the resulting type of the DB-field - it's always a byte-array.

The following code is from the docs - the mapping-tool generates
a table with a field 'url' of type byte-array. I tried to add
the @Type annotation to state that I want a VARCHAR-field but the
type doesn't change.

@Entity
public class MyClass {

  @Persistent
  @Externalizer("toExternalForm")
  @Type(String.class)
  private URL url;

}

In my case I want to use this mechanism to store/retrieve date/time
values for Joda Objects which could be expressed in form of a timestamp
as long. But the same here - the DB-field is a byte-array.
@Persistent
@Externalizer("getMillis")
@Type(Long.class)
private DateMidnight    _MyDate;

What do I miss?

I'm using 
openJPA 0.9.7-SNAPSHOT (2007-03-25)
postgresql-JDBC-8.1-408 (JDBC3)
Java 1.5
Postgres 8.1.5.

Thanks in advance
Lukas

Mime
View raw message