Skip to content
Advertisement

JPA/EclipseLink Error in Creating Tables

I am trying to create a table using EclipseLink. The java class being used is :-

JavaScript

The relevant persistence xml in question is as follows:-

JavaScript

We use the standard method is by implementing the EntityManagerFactory as :-

JavaScript

However I keep getting the following errors :-

EL Warning]: 2017-04-07 14:04:53.768–ServerSession(1650327539)–Exception [EclipseLink-4002] (Eclipse Persistence Services – 2.6.3.v20160428-59c81c5): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLSyntaxErrorException: ORA-00904: : invalid identifier

Error Code: 904 Call: CREATE TABLE SUBMISSIONS (ID NUMBER(19) NOT NULL, XID VARCHAR2(255) NULL, Y VARCHAR2(255) NULL, LEVEL VARCHAR2(255) NULL, STATE VARCHAR2(255) NULL, UDATE DATE NULL, PRIMARY KEY (ID)) Query: DataModifyQuery(sql=”CREATE TABLE SUBMISSIONS (ID NUMBER(19) NOT NULL, XID VARCHAR2(255) NULL, Y VARCHAR2(255) NULL, LEVEL VARCHAR2(255) NULL, STATE VARCHAR2(255) NULL, UDATE DATE NULL, PRIMARY KEY (ID))”)

Advertisement

Answer

Avtually Eclipse reported a bug that rises when there is a reserved word usage you can fine here :
https://bugs.eclipse.org/bugs/show_bug.cgi?id=260637.

the problem comes from using a reserved word I dont actually know your DBMS, if it is Mysql your attributs XID and LEVEL is a reserved word. you can find mysql reserved word here : https://dev.mysql.com/doc/refman/5.7/en/keywords.html.

You can also se from the sql code used to build your tables that there is a column name update of type DATE

UDATE DATE NULL

So to my opinion, you also need watch your attribut name on uDate

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement