This one time, at band camp, John Brayton said:

JB>>can you please provide the relevant fragments of the code you are 
JB>>using (to be able to verify my assumption), but
JB>>looking at this exception, I'd be tempted to say that you are trying 
JB>>to iterate over the related objects after you've
JB>>committed your original transaction.
JB>
JB>This is sample code that produces this problem:
JB>
JB>     OQLQuery query = gdmDatabase.getOQLQuery(
JB>         "select p from jbapp.JbProduct p order by upper(productName)");
JB>     QueryResults results = query.execute(Database.ReadOnly);
JB>     while(results.hasMore()) {
JB>         JbProduct jbProduct = (JbProduct) results.next();
JB>     }
JB>     results.close();
JB>     query.close();
JB>
JB>I am fairly certain that nothing is being closed, committed, or 
JB>rolled back until after the loop.  The stack trace shows that the 
JB>exception is occuring on my second call to results.hasMore().

It seems like the QueryResults object thinks that there are more objects
when, in fact, there are not. I'm not sure what would cause this. Have you
taken a look at the JDO examples (http://www.castor.org/examples.html)?
Sometimes looking through them will clear up some questions you might
have about the mapping descriptor and the use of the API.

JB>I do not encounter this problem if I do not have any object 
JB>relationships in my JbProduct mapping definition.  However, if I 
JB>include this in my mapping definition I do:
JB>
JB>     <field name="publisher" type="jbapp.Publisher" direct="false">
JB>         <sql name="publisher_id" />
JB>     </field>
JB>
JB>I believe the mapping for the jbapp.Publisher class to be correct, 
JB>and I can query Publisher objects independently provided they do not 
JB>have relationships to the JbProduct objects.

Please send more of the mapping descriptor and more client code. I need
to see more of the object graph and your use of Castor. The stuff that
you've posted so far seems to be fine. I'm still not yet sure why the
fetching of your object graph would cause Exceptions unless its mapped
incorrectly or something else is askew.

Bruce
-- 
perl -e 'print unpack("u30","<0G)[EMAIL PROTECTED]&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'

The Castor Project 
http://www.castor.org/

Apache Geronimo 
http://incubator.apache.org/projects/geronimo.html

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to