First
Why did you say that WClientJDO and WApplicationJDO have a
bi-directional relationship? Here is the mapping descriptor for
WClientJDO:

  <class name="test.WClientJDO" key-generator="MAX" identity="id">
    <map-to table="CLIENT" />
    <cache-type type="unlimited" />
    <field name="timestamp" type="long" get-method="jdoGetTimeStamp"
set-method="jdoSetTimeStamp">
      <sql name="CLI_TIMESTAMP" />
      <bind-xml name="timestamp" />
    </field>
    <field name="id" type="big-decimal">
      <sql name="CLI_ID" />
      <bind-xml name="id" />
    </field>
    <field name="name" type="string">
      <sql name="CLI_NAME" />
      <bind-xml name="name" />
    </field>
  </class>

Second:
Why do you say that client is loaded as ReadOnly? 
WClientJDO client = 
        (WClientJDO)_db.load(WClientJDO.class,new BigDecimal(2));

I don't think load is loading as ReadOnly by default?

Thanks,
Guy

-----Message d'origine-----
De�: Bruce Snyder [mailto:ferret@;frii.com] 
Envoy�: jeudi 7 novembre 2002 20:28
��: [EMAIL PROTECTED]
Objet�: Re: [castor-dev] Problem in inserting table with foreign key

This one time, at band camp, Guy Di Fulvio said:

GDF>Here something else on the same pattern that does not work. Could
anyone
GDF>tell me why?
GDF>
GDF>Load an object Client 2/close the transaction
GDF>Load an object Application 1
GDF>Set application.client = Client 2
GDF>Call application.update
GDF>
GDF>The error is:
GDF>org.exolab.castor.jdo.PersistenceException: Object,
GDF>test.WApplicationJDO@a613f8, links to another object,
GDF>test.WClientJDO@6921fd that is not loaded/updated/created in this
GDF>transaction
GDF>
GDF>See code below:
GDF>_db = getDatabase();
GDF>_db.setAutoStore(false);
GDF>_db.begin();
GDF>WClientJDO client = (WClientJDO)_db.load(WClientJDO.class,new
GDF>BigDecimal(2));
GDF>_db.commit();
GDF>_db.close();
GDF>
GDF>_db = getDatabase();
GDF>_db.setAutoStore(false);
GDF>_db.begin();
GDF>WApplicationJDO application =
GDF>(WApplicationJDO)_db.load(WApplicationJDO.class,new BigDecimal(1));
GDF>application.setJdoClient(client);
GDF>_db.commit();
GDF>_db.close();

OK, here's a bit more detail in this one. 

WClientJDO and WApplicationJDO have a bi-directional relationship
established between them via the mapping descriptor. If you load the
client object as read-only, but then you associate it with the
application
object, the client object must change. This is certainly going to be a
problem because Castor cannot modify the client object letting it know
with which application object it is associated.

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

Reply via email to