Gordon Yorke wrote:
> Hello Mitesh,
> I think this is fine for Essentials. Could you add a
> placeholder comment to the fix stating that "is should be
> reconsidered" before migrating the fix to other versions of TopLink
> with older native query support?
Done. Added following comment
// Changed the following code to use
metaData#getColumnLabel() instead of metaData.getColumnName()
// Reconsider whether to migrate this change to other
versions of Toplink with older native query support
String columnName = metaData.getColumnLabel(index + 1);
I am curious what is the older native query support? What potential
issue do you see?
Thanks,
Mitesh
> --Thanks,
> --Gordon
>
> -----Original Message-----
> *From:* Mitesh.Meswani_at_Sun.COM [mailto:Mitesh.Meswani_at_Sun.COM]*On
> Behalf Of *Mitesh Meswani
> *Sent:* Tuesday, September 12, 2006 3:27 PM
> *To:* persistence
> *Subject:* Code review for changes to allow colum aliases in
> Native Queries
>
> Hi Tom,
>
> This is proposed fix for issues similar to one mentioned in
> 6398924
> <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6398924>. The
> issue is about using column aliases in native queries against
> Sybase using DataDirect drivers. We are currently hitting the same
> issue while certifying against Sybase using DataDirect driver.
>
> Toplink uses ResultSetMetadata#getColumnName()
> <http://download.java.net/jdk6/docs/api/java/sql/ResultSetMetaData.html#getColumnName%28int%29>to
> retrieve metadata of a result set where as according to jdbc spec,
> the correct one to use is ResultSetMetaData#getColumnLabel()
> <http://download.java.net/jdk6/docs/api/java/sql/ResultSetMetaData.html#getColumnLabel%28int%29>.
> Could you please review this. Shelly has run cts against Oracle,
> Derby and Sybase(DataDirect) with the fix successfully. I have run
> entity-persisetnce-tests against oracle and derby with the fix.
>
> $ cvs diff
> src/java/oracle/toplink/essentials/internal/databaseaccess/DatabaseAccessor.java
> Index:
> src/java/oracle/toplink/essentials/internal/databaseaccess/DatabaseAccessor.java
> ===================================================================
> RCS file:
> /cvs/glassfish/entity-persistence/src/java/oracle/toplink/essentials/internal/databaseaccess/DatabaseAccessor.java,v
> retrieving revision 1.5
> diff -r1.5 DatabaseAccessor.java
> 847c847
> < String columnName = metaData.*getColumnName*(index + 1);
> ---
> > String columnName = metaData.*getColumnLabel*(index
> + 1);
>
>
> Thanks,
> Mitesh
>
>
>
>