Anything new on this subject? (Problem in inserting table with foreign
key)

Thanks!

-----Message d'origine-----
De�: Dave Carlson [mailto:dcarlson@;ontogenics.com] 
Envoy�: jeudi 3 octobre 2002 23:23
��: [EMAIL PROTECTED]
Objet�: Re: [castor-dev] Problem in inserting table with foreign key

This is exactly the same problem that I posted in a message several days
ago,
but got no responses.  To elaborate using your example, if I set
db.setAutoStore(true) using a long transaction like yours, then the
Client
foreign is inserted, but JDO also inserts a NEW duplicate copy of Client
in the
database (using a new identify generated for the new insert).

-- Dave

----- Original Message -----
From: "Guy Di Fulvio" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, October 03, 2002 2:35 PM
Subject: [castor-dev] Problem in inserting table with foreign key


> Hi,
>
> I am trying to insert in a database a new record WApplication (see
> below) this record depends on WClient which is already in the
database.
> If I don't use the long transactions and do everything between the
same
> begin and commit this works perfectly.
> However if I try to use the long transactions it does not work
> (uncomment below and see).
>
> So what is wrong with what I did?
>
> Thanks,
> Guy
>
> ---------
>
> Version:
> Castor 0.9.3.21
>
> Test Code:
> // Create new WClient
> ...
>      _db.commit();
> _db.close();
>
> _db = getDatabase();
> _db.setAutoStore(false);
> _db.begin();
>
> // load Client (1)
> ...
>
> // If I uncomment the following lines the foreign key (CLI_ID is null)
> // _db.commit();
> // _db.close();
>
> // create new WApplication
> ...
> application.setClient(client);
>
> // If I uncomment the following lines the foreign key (CLI_ID is null)
> // _db = getDatabase();
> // _db.setAutoStore(false);
> //    _db.begin();
>     _db.create(application);
>     _db.commit();
> _db.close();
>
> -----------------------------------------------------------
> 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

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

Reply via email to