This one (see attached) suggested by myself (in a slightly different way)
and (correctly by) Sudhir Bhojwani

Basically what is happening is the code is expecting to find entries in the
result set for the many fields of my object but as the SQL I've written
doesn't include the inner join they aren't going to be there....I'm not sure
what the best way to get around this would be...I can think of a few
options...

1) Just handle the exception and ignore the fact that the fields aren't
there in the result set
2) Add somthing to the parsing of the SQL to detect if all the JOINS are
present in the SQL and work out which fields are going to be present in the
result set...quite complicated I'm sure you'll agree
3) Just don't attempt to set the many fields when using CALL SQL...thereby
reducing the usefulness of the CALL SQL pass through if you actually did
want to perform the JOINS...

Brett

----- Original Message -----
From: "Bruce Snyder" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 18, 2002 7:48 PM
Subject: Re: [castor-dev] CALL SQL and One to Many relationships problem


> This one time, at band camp, Brett Cherrington said:
>
> BC>Heres the top half of the exception trace.....(This is after the fix I
made
> BC>to SQLEngine.createCall to check for no sql name)
>
> What fix is this? Can you confirm that this fix is not affecting
> anything here?
>
> BC>java.sql.SQLException: Invalid column index
> BC>
> BC>at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
> BC>
> BC>at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:222)
> BC>
> BC>at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:285)
> BC>
> BC>at
>
BC>oracle.jdbc.driver.OracleStatement.prepare_for_new_get(OracleStatement.ja
va:
> BC>2795)
> BC>
> BC>at
>
BC>oracle.jdbc.driver.OracleStatement.getBigDecimalValue(OracleStatement.jav
a:3
> BC>998)
> BC>
> BC>at
>
BC>oracle.jdbc.driver.OracleResultSetImpl.getBigDecimal(OracleResultSetImpl.
jav
> BC>a:577)
> BC>
> BC>at org.exolab.castor.jdo.engine.SQLTypes.getObject(SQLTypes.java:319)
> BC>
> BC>at
>
BC>org.exolab.castor.jdo.engine.SQLEngine$SQLQuery.loadMultiField(SQLEngine.
jav
> BC>a:1822)
> BC>
> BC>at
>
BC>org.exolab.castor.jdo.engine.SQLEngine$SQLQuery.loadRow(SQLEngine.java:18
52)
> BC>
> BC>at
>
BC>org.exolab.castor.jdo.engine.SQLEngine$SQLQuery.fetchRaw(SQLEngine.java:1
929
> BC>)
> BC>
> BC>at
>
BC>org.exolab.castor.jdo.engine.SQLEngine$SQLQuery.nextIdentity(SQLEngine.ja
va:
> BC>1737)
> BC>
> BC>at
>
BC>org.exolab.castor.persist.QueryResults.nextIdentity(QueryResults.java:173
)
> BC>
> BC>at
>
BC>org.exolab.castor.jdo.engine.OQLQueryImpl$OQLEnumeration.hasMore(OQLQuery
Imp
> BC>l.java:598)
> BC>
> BC>at
>
BC>org.exolab.castor.jdo.engine.OQLQueryImpl$OQLEnumeration.hasMore(OQLQuery
Imp
> BC>l.java:584)
>
> Are your relationships bi-directional? Can you select this object graph
> successfully with an OQL query?
>
> Bruce
> --
> +--------------------------+--------------------------+
> | Bruce Snyder             | Senior Software Engineer |
> | [EMAIL PROTECTED] | Digital Globe            |
> | 720.494.4870             | Longmont, CO             |
> +-----------------------------------------------------+
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
>
==== 
//depot/everest/main/sw/thirdparty/castor/src/main/org/exolab/castor/jdo/engine/SQLEngine.java#2
 - 
/home/sbhojwani/src/everest/main/sw/thirdparty/castor/src/main/org/exolab/castor/jdo/engine/SQLEngine.java
 ====
412a413,418
>         // changes for the SQL Direct interface begins here
>         if(spCall.startsWith("SQL")){
>             sql =spCall.substring(4);
>             return new SQLQuery( this, sql, types );
>         }
>         //this is for stored procedure
417d422
< 
433,441c438
<         // changes for the SQL Direct interface begins here
<         if(spCall.startsWith("SQL")){
<             sql =spCall.substring(4);
<             return new SQLQuery( this, sql, types );
<         } else{
<             return ((BaseFactory) _factory).getCallQuery( spCall, 
types,_clsDesc.getJavaClass(), jdoFields, sqlTypes );
<         }
< 
<        
---
>         return ((BaseFactory) _factory).getCallQuery( spCall, 
>types,_clsDesc.getJavaClass(), jdoFields, sqlTypes );

Reply via email to