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

Bug 333739

Summary: identifiers are not delimited in all cases despite <delimited-identifiers />
Product: z_Archived Reporter: Martin Geisse <mgeisse>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P2 CC: maciekmal, peter, tom.ware
Version: unspecified   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Bug Depends on: 367887    
Bug Blocks:    
Attachments:
Description Flags
source code for the entity class
none
orm.xml none

Description Martin Geisse CLA 2011-01-07 08:12:38 EST
Build Identifier: M20100909-0800

With PostgreSQL, I have to double-quote all identifiers or they'll be implicitly lower-cased. I'd prefer to preserve case since "lastLoginAttemptIpAddress" is so much more readable than "lastloginattemptipaddress".

I have created an orm.xml file with <delimited-identifiers /> (full contents attached, as is the source code for the entity class). That caused EclipseLink to quote most of the identifiers, but it specifically did not quote the column name when defining a foreign key constraint. I was advised on the eclipselink-users mailing list to file this as a bug. The offending SQL command is (note the missing quotes around the column name):

ALTER TABLE "UserX" ADD CONSTRAINT "FK_UserX_modificationUser_id" FOREIGN KEY (modificationUser_id) REFERENCES "UserX" (id)

I have also tried using quotes in the explicitly specified table / column names to cause EL to quote identifiers, but the behavior is exactly the same.

This behavior occurs in EclipseLink versions 2.1.2, as well as the 2.1.3 and 2.2.0 nightly builds.


Reproducible: Always

Steps to Reproduce:
1. use a database that demands delimited identifiers such as PostgreSQL with uppercase letters in the identifiers
2. define an entity class with a ManyToOne relation to cause EclipseLink to create a foreign key constraint
3. enable DDL generation such that the cosntraint creation command is actually sent to the database
4. use <delimited-identifiers /> to cause identifiers to be delimited, which doesn't happen in all cases
Comment 1 Martin Geisse CLA 2011-01-07 08:15:07 EST
Created attachment 186267 [details]
source code for the entity class
Comment 2 Martin Geisse CLA 2011-01-07 08:17:02 EST
Created attachment 186268 [details]
orm.xml
Comment 3 Martin Geisse CLA 2011-01-09 16:19:02 EST
The issue also occurs with <delimited-identifiers /> and CriteriaBuilder.function(...): The function name is not delimited either. However, in this case adding explicit double-quotes in the function name (the first argument to CriteriaBuilder.function()) causes EclipseLink to quote the function name in the SQL command. So the course of action seems to be different here: quoting *is* possible, just <delimited-identifiers /> does not enable it.
Comment 4 Martin Geisse CLA 2011-01-11 12:00:22 EST
Another occurence: For a column with @SequenceGenerator, the sequence name is not quoted automatically. Adding explicit quotes in the sequence name fixes the problem just like it does for function names.
Comment 5 Tom Ware CLA 2011-01-26 14:47:25 EST
Setting target and priority.  See the following page for the meanings of these fields:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines
Comment 6 Peter Donald CLA 2011-10-05 01:47:36 EDT
Another scenario in which identifiers are not qualified is the schema name when using the H2 database. Typically this will result in tables named 

Planner."tblShift"

rather than

"Planner"."tblShift"
Comment 7 Eclipse Webmaster CLA 2022-06-09 10:36:18 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink