Community
Participate
Working Groups
When executing a query which has had setMaxResults set on it, column names are aliased and when the column name is already very long the alias will exceed 30 characters, causing the ORA-00972 error. As an example, in my situation one of the columns is named 'max_price_patient_split_copay' which is 30 characters. When the query is generated this is aliased as follows: 'max_price_patient_split_copay AS max_price_patient_split_copay56'. This bug can be reproduced by using any column name that is already 30 characters and then executing a query like this: entityManager.createQuery("SELECT t FROM Test t").setMaxResults(10).getResultList();
See additional example of the ORA-00972 30 char limitation in our JPA example code which usually shows up first in the @SequenceGenerator names - because they tend to be larger supersets of the column names. http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/examples/org.eclipse.persistence.example.jpa.server.weblogic.enterpriseEJB/ejbModule/org/eclipse/persistence/example/jpa/server/business/Cell.java @Id // keep the sequence column name under 30 chars to avoid an ORA-00972 @SequenceGenerator(name="EL_SEQUENCE_CELL", sequenceName="EL_CELL_SEQ", allocationSize=25) @GeneratedValue(generator="EL_SEQUENCE_CELL") private BigInteger id;
Setting target to 1.1X so this bug will be a candidate for the first patch release after 1.1
7337866
*** Bug 241919 has been marked as a duplicate of this bug. ***
Example implementation of the workaround proposed in Bug 241919 which is working for me: public class MySessionCustomizer implements SessionCustomizer { public MySessionCustomizer () { } public void customize(Session session) throws Exception { // TODO: temporary workaround for EclipseLink bug 262923 & 241919 Platform datasourcePlatform = session.getDatasourcePlatform(); OraclePlatform oraclePlatform = (OraclePlatform)datasourcePlatform; oraclePlatform.setShouldUseRownumFiltering(false); } } In persistence.xml: [...] <properties> [...] <property name="eclipselink.session.customizer" value="mypackage.MySessionCustomizer "/>
Created attachment 134124 [details] Limit alias name length to Platform maximum field length - Eclipse 1.0.2 patch Patch against Eclipse 1.0.2 to restrict generated alias names in SQLSelectStatement to the maximum alias length, if specified, and to set the maximum alias length to the maximum field length for the OraclePlatform. New alias name algorithm truncates the column name as much as needed if the resulting string would be too long.
Patch checked in as contributed - reviewed by Peter. Note, at this time the max alias is only get set from the Oracle platform.
fixing target
Mass update to change fixed in target.
This has been backported to 1.1.3.
Additional issue fixed in 1.2.0 branch for 1.2.1 - http://fisheye2.atlassian.com/changelog/~author=pkrogh/eclipselink/?cs=5682 1.1.0 branch for 1.1.4 - http://fisheye2.atlassian.com/changelog/~author=pkrogh/eclipselink/?cs=5680 trunk for 2.0.0 - http://fisheye2.atlassian.com/changelog/~author=pkrogh/eclipselink/?cs=5678
*** Bug 294971 has been marked as a duplicate of this bug. ***
Base bug was fixed in trunk in r4559 This made its way into 1.2.0 http://fisheye2.atlassian.com/changelog/eclipselink/?cs=4559
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink