Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 365261

Summary: The generated SQL Add code got error when primitive key is self increased
Product: z_Archived Reporter: Xin Wu <cdlwuxin>
Component: EDTAssignee: Project Inbox <edt.javagen-inbox>
Status: CLOSED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: chenzhh, jspadea, jvincens, smythew, svihovec, zhuzhi
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Xin Wu CLA 2011-11-30 22:04:50 EST
Build Identifier: EDT 0.7 GM build

The generated SQL Add code got error when primitive key is self increased. The primitive key was included in generated SQL. This will cause a conflict when insert data.

Reproducible: Always

Steps to Reproduce:
1. Create a Simple table in database with primitive key self increasing. (I got the error in derby)
2. Create a Web Client with service project.And create the record from DB.
3. Write a service/program/handler to do the add operation. Just using the basic add syntax "add action_targets to data_source_expr "
4. The generated SQL insert statement in Java code will include primitive key. This will cause a conflict in runtime.
Comment 1 Xin Wu CLA 2011-12-01 20:53:40 EST
If modify the auto added SQL statement to exclude the primitive key, the generated Java code still contains the primitive key. Which will cause a column mismatch SQL error.
Comment 2 Xin Wu CLA 2011-12-14 20:36:33 EST
Found that just need to add annotation @GeneratedValue behind the PK, so closed this bug.