I know this is a Java forum, but I'm hoping that one of those smart Hibernate folks will be able to help me.
I've created a simple table in PostgreSQL 8.1 called PERSON:
REATE TABLE "PERSON"
(
"PERSON_ID" int4 NOT NULL DEFAULT nextval('"PERSON_PERSON_ID_seq"'::regclass),
"FIRST_NAME" varchar,
"LAST_NAME" varchar NOT NULL,
CONSTRAINT "PK_PERSON" PRIMARY KEY ("PERSON_ID")
)
WITHOUT OIDS;
ALTER TABLE "PERSON" OWNER TO pgsuper;
The PERSON_ID column is type serial - like an Oracle sequence. PostgreSQL automatically created a sequence named PERSON_PERSON_ID_seq for me.
I'm having problems getting the next ID out of that sequence.
If I go into the PostgreSQL admin console and do some INSERTs, all is well. But when I try to execute this SELECT in JDBC I have problems. I'm using the query that the PostgreSQL documentation says is correct:
SELECT nextval("PERSON_PERSON_ID_seq")
I get back a SQL state 42703 and the following exception:
org.postgresql.util.PSQLException: ERROR: column "PERSON_PERSON_ID_seq" does not exist
Does anyone have any advice as to how I should proceed? Thanks - %