openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Baum...@ggrz-hagen.nrw.de>
Subject Primary key field generation with postgres
Date Wed, 13 Feb 2008 13:24:45 GMT
I use Postgres 8.2 with jdbc Type 3 driver. 

I have got the following table definition:

 

create table ves.user

(id                    serial    not null,

 user                 varchar(20) not null,

 password         varchar(20) not null, 

 constraint pk_ves_user primary key(id)

);

 

 

My PAO Class looks like: 

 

@Entity

@Table(schema="ves", name="user")

public class UserPAO implements Serializable {

            @Id

            @GeneratedValue(strategy=IDENTITY)

            @Column(insertable=false, updatable = false)

            private long id;

            ....

 

Trying to insert a new user results in an persistence exception: The
invalid statement is reported 

As: select currval('user_id_seq')

 

But the table is in the schema "ves", so the correct name of the
sequence is ves.user_id_seq. 

If I put the table into the public schema, and omit the schema="ves"
statement in the @Table

annotation, all works. 

 

How can I use automatic key generation with Postgres without putting the
table into the public schema??

Table generation and all other things did not work.

 

Thanks in advance,....

 

 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message