Re: BUG #3920: sequence not generated for postgres using toplink jpa - Mailing list pgsql-bugs

From Arun ViswanathanChandrika
Subject Re: BUG #3920: sequence not generated for postgres using toplink jpa
Date
Msg-id EC90E801BE917645B6DB6239B85E78940391A5E1@TRVMSG.ustr.com
Whole thread Raw
In response to BUG #3920: sequence not generated for postgres using toplink jpa  ("Arun" <arun.viswanathanchandrika@ust-global.com>)
List pgsql-bugs
Hi=20
Solution is available at
http://forums.oracle.com/forums/thread.jspa?messageID=3D2325330&#2325330


-----Original Message-----
From: Arun ViswanathanChandrika=20
Sent: Friday, February 01, 2008 8:22 PM
To: pgsql-bugs@postgresql.org
Subject: BUG #3920: sequence not generated for postgres using toplink
jpa


The following bug has been logged online:

Bug reference:      3920
Logged by:          Arun
Email address:      arun.viswanathanchandrika@ust-global.com
PostgreSQL version: 8.2
Operating system:   Win XP
Description:        sequence not generated for postgres using toplink
jpa
Details:=20

sequence not generated for postgres using toplink jpa



This sequence generator code is not working properly

@SequenceGenerator(name=3D"catalog_seq_gen", sequenceName=3D"catalog_seq",
allocationSize=3D1)
@Id @GeneratedValue(strategy =3D GenerationType.SEQUENCE,generator =3D
"catalog_seq_gen")
@Column(name =3D"catalog_id", nullable =3D false)
private Long catalogId;

@Column(name =3D "CATALOG_NAME", nullable =3D false)
private String catalogName;
@Column(name =3D "CATALOG_DESC")
private String catalogDesc;=20


I have 3 fields in the code and toplink is generating the query wrongly

Exception in thread "main" javax.persistence.PersistenceException:
javax.persistence.PersistenceException: Exception [TOPLINK-4002] (Oracle
TopLink Essentials - 2.0 (Build SNAPSHOT (06/04/2007))):
oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: org.postgresql.util.PSQLException: ERROR: null value
in
column "catalog_id" violates not-null constraint
Error Code: 0
Call: INSERT INTO CATALOG (CATALOG_NAME, CATALOG_DESC) VALUES (?, ?)
bind =3D> [Description, null]



ideally it should generate=20

INSERT INTO CATALOG (CATALOG_ID, CATALOG_NAME, CATALOG_DESC) VALUES
(?,?,
?)
bind =3D> [1, Description, null]



I am using Oracle TopLink 11g: Technical Preview 3=20

what could be the reason?

pgsql-bugs by date:

Previous
From: "Maximiliano"
Date:
Subject: BUG #3922: Problems migrating databases.
Next
From: Peter Eisentraut
Date:
Subject: Re: BUG #3922: Problems migrating databases.