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:
sequence not generated for postgres using toplink jpa
This sequence generator code is not working properly
@SequenceGenerator(name="catalog_seq_gen", sequenceName="catalog_seq",
allocationSize=1)
@Id @GeneratedValue(strategy = GenerationType.SEQUENCE,generator =
"catalog_seq_gen")
@Column(name ="catalog_id", nullable = false)
private Long catalogId;
@Column(name = "CATALOG_NAME", nullable = false)
private String catalogName;
@Column(name = "CATALOG_DESC")
private String catalogDesc;
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 => [Description, null]
ideally it should generate
INSERT INTO CATALOG (CATALOG_ID, CATALOG_NAME, CATALOG_DESC) VALUES (?,?,
?)
bind => [1, Description, null]
I am using Oracle TopLink 11g: Technical Preview 3
what could be the reason?