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

Bug 241919

Summary: Problem with aliasing for the identifiers having more than 30 characters.
Product: z_Archived Reporter: BalaKrishna P <balakrishna.mca>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P2 CC: christopher.delahunt, eclipselink.foundation-inbox, michael.f.obrien, mkienenb, neil.hauge
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description BalaKrishna P CLA 2008-07-24 02:38:03 EDT
Build ID: N/A

Steps To Reproduce:
1. Table having fields with length of 30 chars
2. Try to do read operation on it which will fail as generated query contains identifiers having more than 30 characters length.


More information:
Currently i am following the workaround using the OraclePlatform setShouldUseRownumFiltering(false)
Comment 1 Mike Kienenberger CLA 2009-02-18 14:00:13 EST
Related to (or duplicate of) bug 262923, which is targeted for 1.1X.

Aliased column names result in ORA-00972
https://bugs.eclipse.org/bugs/show_bug.cgi?id=262923
Comment 2 Michael OBrien CLA 2009-02-18 14:28:04 EST
Mike K. thanks for linking these two. 

*** This bug has been marked as a duplicate of bug 262923 ***
Comment 3 Chris Delahunt CLA 2009-02-18 14:46:55 EST
This is not quite a duplicate of bug 262923 because it is a different situation.  Bug 262923 deals with EclipseLink generating Database column names from attribute names based on the JPA specification and hitting the 30character Oracle limit.  This bug is dealing with already defined database column names that are at the limit or near it (ie 29 characters).  With such a column name, using the RownumFiltering option will cause EclipseLink to generate aliases for the column - this currently is a concatenation of the column name and an index, increasing the length of the alias beyond the limit.

 
Comment 4 Mike Kienenberger CLA 2009-02-18 14:58:55 EST
Chris,

I don't know about the "@SequenceGenerator" part of the comments described by Michael OBrien, but the initial description for 262923 as well as the behavior I'm seeing (after upgrading from TopLink Essentials) is identical to what you just described.

I have a table with a predefined 30-character field, and when I do a query.getResultList(), it generates field + 2-digit index.

I suspect Michael is saying the same thing that you are, only he's pointing out that the example code has to unnecessarily restrict the length of names so that they don't trigger this bug when the identifier exceeds 30 characters in Oracle.  But I'll let him comment on that.
Comment 5 Chris Delahunt CLA 2009-02-18 15:09:17 EST
This bug will only reproduce if you have set the max results or first rows that should be returned for a query.  When these are set, EclipseLink (depending on platform support) will attempt to use rownum filtering, and wrap the initial generated SQL with database specific code.  To get around the fact that some columns may be in the initial SQL twice and the problem databases (Oracle) have with dealing with columns using the same name in the wrapped SQL, unique aliases needed to be used - hence the concatination of an index.  

If you hit this problem and must use max/first rows on queries, you can workaround the issue by calling setShouldUseRownumFiltering(false) on the DatabasePlatform.  This will prevent EclipseLink from using the platform's rownum filtering support, so it does not need to add the index to generate unique aliases.  

bug 262923 deals with EclipseLink generating column names, and so should be dealt with independently from this one.  In this bug, the column names are correct (potentially anyway, they are user defined) and cannot be changed.  It is the choice of aliases that hits the limit.
Comment 6 Peter Krogh CLA 2009-11-27 13:54:45 EST
 This bug is being moved to Future where we can properly sort them all together based on community votes and severity. We will then assign them accordingly to future patch sets and releases.
Comment 7 Peter Krogh CLA 2009-11-30 11:36:48 EST
Changing the priority of the bugs that have been recently triaged to future.  Targetting them to P2 will differentiate them from the P3s that have been triaged into future earlier.
Comment 8 Chris Delahunt CLA 2013-09-03 13:05:07 EDT
Fixed through the fix for bug 261076
https://bugs.eclipse.org/bugs/show_bug.cgi?id=261076
switching aliases to use a1, a2, etc.
Comment 9 Eclipse Webmaster CLA 2022-06-09 10:31:58 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink