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

GDF>Anything new on this subject? (Problem in inserting table with foreign
GDF>key)
GDF>
GDF>Thanks!
GDF>
GDF>-----Message d'origine-----
GDF>De�: Dave Carlson [mailto:dcarlson@;ontogenics.com] 
GDF>Envoy�: jeudi 3 octobre 2002 23:23
GDF>��: [EMAIL PROTECTED]
GDF>Objet�: Re: [castor-dev] Problem in inserting table with foreign key
GDF>
GDF>This is exactly the same problem that I posted in a message several days
GDF>ago,
GDF>but got no responses.  To elaborate using your example, if I set
GDF>db.setAutoStore(true) using a long transaction like yours, then the
GDF>Client
GDF>foreign is inserted, but JDO also inserts a NEW duplicate copy of Client
GDF>in the
GDF>database (using a new identify generated for the new insert).
GDF>
GDF>-- Dave
GDF>
GDF>----- Original Message -----
GDF>From: "Guy Di Fulvio" <[EMAIL PROTECTED]>
GDF>To: <[EMAIL PROTECTED]>
GDF>Sent: Thursday, October 03, 2002 2:35 PM
GDF>Subject: [castor-dev] Problem in inserting table with foreign key
GDF>
GDF>
GDF>> Hi,
GDF>>
GDF>> I am trying to insert in a database a new record WApplication (see
GDF>> below) this record depends on WClient which is already in the
GDF>database.
GDF>> If I don't use the long transactions and do everything between the
GDF>same
GDF>> begin and commit this works perfectly.
GDF>> However if I try to use the long transactions it does not work
GDF>> (uncomment below and see).
GDF>>
GDF>> So what is wrong with what I did?
GDF>>
GDF>> Thanks,
GDF>> Guy
GDF>>
GDF>> ---------
GDF>>
GDF>> Version:
GDF>> Castor 0.9.3.21
GDF>>
GDF>> Test Code:
GDF>> // Create new WClient
GDF>> ...
GDF>>      _db.commit();
GDF>> _db.close();
GDF>>
GDF>> _db = getDatabase();
GDF>> _db.setAutoStore(false);
GDF>> _db.begin();
GDF>>
GDF>> // load Client (1)
GDF>> ...
GDF>>
GDF>> // If I uncomment the following lines the foreign key (CLI_ID is null)
GDF>> // _db.commit();
GDF>> // _db.close();
GDF>>
GDF>> // create new WApplication
GDF>> ...
GDF>> application.setClient(client);
GDF>>
GDF>> // If I uncomment the following lines the foreign key (CLI_ID is null)
GDF>> // _db = getDatabase();
GDF>> // _db.setAutoStore(false);
GDF>> //    _db.begin();
GDF>>     _db.create(application);
GDF>>     _db.commit();
GDF>> _db.close();

Guy, 

Can you jar up a small test for this including your client code, mapping
descriptor and DDL? This would be very helpful in tracking down this  problem. 

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

Reply via email to