Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

sequence not generated for postgres

413304Feb 1 2008 — edited Feb 2 2008
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?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 1 2008
Added on Feb 1 2008
2 comments
3,150 views