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

Bug 366852

Summary: Table is incorrectly generated
Product: z_Archived Reporter: Javier Ortiz <javier.ortiz.78>
Component: EclipselinkAssignee: Project Inbox <eclipselink.orm-inbox>
Status: NEW --- QA Contact:
Severity: major    
Priority: P2 CC: martin.grebac, tom.ware
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Javier Ortiz CLA 2011-12-15 13:10:49 EST
Build Identifier: 2.3.2.v20111125-r10461

I have a table part of my application that is not being populated as per the annotations. I enabled Eclipselink logging level INFO to see what's going on as I suspected it was related to the database (H2). To my surprise it seems eclipselink is creating the class wrong.

See attachment for persistence classes

Here are the related errors:

CREATE TABLE xinco_id (tablename VARCHAR(50) NOT NULL, last_id NUMERIC(38), PRIMARY KEY (tablename)) [42101-161]
Error Code: 42101
Call: CREATE TABLE xinco_id (tablename VARCHAR(50) NOT NULL, last_id NUMERIC(38), PRIMARY KEY (tablename))
Query: DataModifyQuery(sql="CREATE TABLE xinco_id (tablename VARCHAR(50) NOT NULL, last_id NUMERIC(38), PRIMARY KEY (tablename))")
[EL Warning]: 2011-12-15 11:21:37.737--ServerSession(2306742)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: org.h2.jdbc.JdbcSQLException: NULL not allowed for column "ID"; SQL statement:
INSERT INTO xinco_id(tablename, last_id) values ('xinco_core_language', 999) [23502-161]
Error Code: 23502

Reproducible: Always

Steps to Reproduce:
1. Run attached sample
2. Check xinco_id related messages (near the end)
3. Notice wrong creation of table: CREATE TABLE xinco_id (tablename VARCHAR(50) NOT NULL, last_id NUMERIC(38), PRIMARY KEY (tablename)) vs. the (sometimes) correct one on 2.3.0: CREATE TABLE xinco_id (id INTEGER(11) NOT NULL, tablename VARCHAR(50) NOT NULL, last_id NUMERIC(38), PRIMARY KEY (id))

Also notice the wrong attempt to insert a value (in both versions):
[EL Warning]: 2011-12-15 12:09:28.026--ServerSession(5298332)--Thread(Thread[mai
n,5,main])--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v
20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: org.h2.jdbc.JdbcSQLException: NULL not allowed for column "I
D"; SQL statement:
INSERT INTO xinco_id(tablename, last_id) values ('xinco_core_data', 999) [23502-
161]
Error Code: 23502
Call: INSERT INTO xinco_id(tablename, last_id) values ('xinco_core_data', 999)
Query: DataModifyQuery(sql="INSERT INTO xinco_id(tablename, last_id) values ('xi
nco_core_data', 999)")
Comment 1 Javier Ortiz CLA 2011-12-15 13:24:49 EST
The test case file is too large. It can be found here: https://docs.google.com/open?id=0B1oCYY8ny-i1NjUxMjQ2MmMtMGVlYi00MmFjLWIzYzMtOGU1ZjNlYTBhZDAx
Comment 2 Tom Ware CLA 2012-01-23 10:38:54 EST
Setting target and priority.  See the following page for the meanings of these fields:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines

Community: Please vote for this bug if it is important to you.  Votes are one of the main criteria we use to determine which bugs to fix next.
Comment 3 Eclipse Webmaster CLA 2022-06-09 10:08:44 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink