Yeah....sorry about the example I cribbed it from my real code....didn't
want to include my actual mapping file as its quite big....
Heres the top half of the exception trace.....(This is after the fix I made
to SQLEngine.createCall to check for no sql name)
java.sql.SQLException: Invalid column index
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:222)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:285)
at
oracle.jdbc.driver.OracleStatement.prepare_for_new_get(OracleStatement.java:
2795)
at
oracle.jdbc.driver.OracleStatement.getBigDecimalValue(OracleStatement.java:3
998)
at
oracle.jdbc.driver.OracleResultSetImpl.getBigDecimal(OracleResultSetImpl.jav
a:577)
at org.exolab.castor.jdo.engine.SQLTypes.getObject(SQLTypes.java:319)
at
org.exolab.castor.jdo.engine.SQLEngine$SQLQuery.loadMultiField(SQLEngine.jav
a:1822)
at
org.exolab.castor.jdo.engine.SQLEngine$SQLQuery.loadRow(SQLEngine.java:1852)
at
org.exolab.castor.jdo.engine.SQLEngine$SQLQuery.fetchRaw(SQLEngine.java:1929
)
at
org.exolab.castor.jdo.engine.SQLEngine$SQLQuery.nextIdentity(SQLEngine.java:
1737)
at
org.exolab.castor.persist.QueryResults.nextIdentity(QueryResults.java:173)
at
org.exolab.castor.jdo.engine.OQLQueryImpl$OQLEnumeration.hasMore(OQLQueryImp
l.java:598)
at
org.exolab.castor.jdo.engine.OQLQueryImpl$OQLEnumeration.hasMore(OQLQueryImp
l.java:584)
at
com.bbct.services.search.dbsearcher.CastorJDOSearchImplEJB.search(CastorJDOS
earchImplEJB.java:116)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(Stateles
sSessionContainer.java:664)
at
org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(Cach
edConnectionInterceptor.java:186)
at
org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSe
ssionInstanceInterceptor.java:77)
at
org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor
.java:96)
at
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.
java:167)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:61)
at
org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:12
9)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:166)
at
org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.jav
a:313)
at
org.jboss.ejb.plugins.local.BaseLocalContainerInvoker.invoke(BaseLocalContai
nerInvoker.java:296)
at
org.jboss.ejb.plugins.local.StatelessSessionProxy.invoke(StatelessSessionPro
xy.java:81)
----- Original Message -----
From: "Bruce Snyder" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 11, 2002 4:46 PM
Subject: Re: [castor-dev] CALL SQL and One to Many relationships problem
> This one time, at band camp, Brett Cherrington said:
>
> Brett,
>
> Please see my comments inline.
>
> BC><class name="myObject" identity="id">
> BC>
> BC><description></description>
> BC>
> BC><map-to table="dev.object" />
> BC>
> BC>
> BC><field name="a" type="string" >
> BC>
> BC><sql name="a" type="varchar"/>
> BC>
> BC></field>
> BC>
> BC>
> BC><field name="b" type="string" >
> BC>
> BC><sql name="b" type="varchar"/>
> BC>
> BC></field>
> BC>
> BC>
> BC><field name="c" type="cObject" collection="collection" lazy="true"
required="false">
> BC>
> BC><sql many-key="mid"/>
> BC>
> BC></field>
> ...
> BC></class>
> BC>
> BC>I am then using the following OQL to query for the objects
> BC>
> BC>CALL SQL SELECT id, a, b FROM dev.object AS myObject
>
> The CALL SQL requires that the select statement list fields in the order
> in which they appear in the mapping descriptor. The mapping descriptor
> posted above does not include the id field other than noting that it is
> the identity. There is no separate <field> element.
>
> BC>I expected this to return me the objects but without the cObjects (as I
havn't done the INNER JOIN)...??? Is this correct...?
>
> This should be what is returned.
>
> BC>However, first of all I get a NullPointerException in createCall in
SQLEngine because I havn't provided a sql name attribute for the many object
in my myObject class....I have done a quick fix for this but it leads to
another problem.....In SQLTypes it appears to still try and populate the
many fields in getObject() so fails with a SQLException: Invalid column
index....
>
> This seems odd. Are you relations bi-directional? Can you post the full
stack trace?
>
> Bruce
> --
> perl -e 'print
unpack("u30","<0G)U8V4\@4VYY9&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
>
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev