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

Bug 351308

Summary: Field names shut be escaped with ` by eclipse link
Product: z_Archived Reporter: Klemens Muthmann <klemens.muthmann>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: CLOSED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: tom.ware
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Klemens Muthmann CLA 2011-07-06 07:26:09 EDT
Hi,

I faced the following problem. I had a field called "left" in a JPA entity. Since "left" is a keyword in SQL, automatic table creation and insertion of new objects did not work. However I would have expected that EclpseLink masks each field name with ` so all names are possible.

What EclipseLink does:
INSERT INTO POSITIONALREFERENCE (IDENTIFIER, HEIGHT, LEFT, TOP, VALUE, WIDTH, `RESOURCE_IDENTIFIER`) VALUES (15, 2104, 144, 8855, "test",2779, '10')

What I think it should do:
INSERT INTO POSITIONALREFERENCE (`IDENTIFIER`, `HEIGHT`, `LEFT`, `TOP`, `VALUE`, `WIDTH`, `RESOURCE_IDENTIFIER`) VALUES (15, 2104, 144, 8855, "test",2779, '10')

Even if this is not possible it would be good to provide a more meaninful error message and not just do not create the entities table.

(I think this bug is valid for 2.3.0 as well, but I changed versions a few days ago, since my first idea was that the new version introduced problems.)
Comment 1 Tom Ware CLA 2011-07-06 11:44:23 EDT
You can delimit your identifiers as defined in the JPA specification.  This is not done automatically for you because we don't know in advance which delimiters you want delimited and do not maintain a list of all the reserved words for every database we support.  JPA also provides a way to set a default so all identifiers are delimited.

See section 2.13 of the JPA 2.0 spec for some initial info.
Comment 2 Eclipse Webmaster CLA 2022-06-09 10:14:05 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink
Comment 3 Eclipse Webmaster CLA 2022-06-09 10:19:32 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink