|
I get the following stack trace when I call update
on the parent object with 1:1 with a child object. The exception does not
occur if I remove the depends element from the Child class mapping.
org.exolab.castor.jdo.PersistenceException:
Requested to load/fetch an object of type Child, where persistent storage
returned an object of type class org.exolab.castor.persist.OID
at org.exolab.castor.persist.TransactionContext.load(TransactionContext.java:528) at org.exolab.castor.persist.TransactionContext.load(TransactionContext.java:486) at org.exolab.castor.persist.ClassMolder.update(ClassMolder.java:1762) at org.exolab.castor.persist.LockEngine.update(LockEngine.java:640) at org.exolab.castor.persist.TransactionContext.markUpdate(TransactionContext.java:909) at org.exolab.castor.persist.TransactionContext.update(TransactionContext.java:978) at org.exolab.castor.jdo.engine.DatabaseImpl.update(DatabaseImpl.java:353) at OracleTest.test(OracleTest.java:177) at OracleTest.main(OracleTest.java:50) I am using the Castor snapshot from 8/21/2001 with
Oracle. I have attached my database.xml, mapping.xml and Java
files.
Another question I have is : Can objects retrieved
using an OQL query participate in long transactions.
Thanks in advance.
Naveen
|
<!-- Database file for Castor JDO -->
<database name="NCS" engine="oracle">
<driver class-name="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@sultar.sdd.comsat.com:1521:ncs1">
<param name="user" value="ncs"/>
<param name="password" value="ncs"/>
</driver>
<mapping href="mapping.xml"/>
</database>
<?xml version="1.0"?> <!DOCTYPE mapping SYSTEM "http://castor.exolab.org/mapping.dtd"> <mapping> <!-- The primary key generator sequence.--> <key-generator name="SEQUENCE" alias="PRIMARYKEY"> <param name="sequence" value="PRIMARYKEY"/> </key-generator> <!-- Mapping for class Parent --> <class name="Parent" identity="oid" key-generator="PRIMARYKEY" access="shared"> <cache-type type="unlimited"/> <map-to table="Parent"/> <!-- Mapping for attributes --> <field name="oid" type="long" required="false" direct="true" lazy="false"> <sql name="oid" type="bigint" dirty="check"/> </field> <field name="value" type="integer" required="false" direct="true" lazy="false"> <sql name="value" type="integer" dirty="check"/> </field> <field name="child" type="Child" required="false" direct="true" lazy="false"> <sql many-key="parentOid"/> </field> </class> <!-- Mapping for class Child --> <class name="Child" identity="oid" key-generator="PRIMARYKEY" access="shared" depends="Parent"> <cache-type type="unlimited" /> <map-to table="Child"/> <!-- Mapping for attributes --> <field name="oid" type="long" required="false" direct="true" lazy="false"> <sql name="oid" type="bigint" dirty="check"/> </field> <field name="value" type="integer" required="false" direct="true" lazy="false"> <sql name="value" type="integer" dirty="check"/> </field> <field name="parent" type="Parent" required="false" direct="true" lazy="false"> <sql name="parentOid" dirty="check"/> </field> </class> <!-- Mapping for class Test --> <class name="Test" identity="oid" key-generator="PRIMARYKEY" access="shared"> <cache-type type="unlimited" /> <map-to table="Test"/> <!-- Mapping for attributes --> <field name="oid" type="long" required="false" direct="true" lazy="false"> <sql name="oid" type="bigint" dirty="check"/> </field> <field name="value" type="integer" required="false" direct="true" lazy="false"> <sql name="value" type="integer" dirty="check"/> </field> </class> </mapping>
Test.java