Sorry, mis-read the order of your objects and my change wont really do
anything useful :) But you may want to try updating both objects in the
second transaction (in sample 2) and see what it gives you.
-------Original Message-----
--From: Nick Stuart [mailto:[EMAIL PROTECTED]
--Sent: Wednesday, June 23, 2004 2:15 PM
--To: [EMAIL PROTECTED]
--Subject: Re: [castor-user] long transaction and many-to-many
--relationships
--
--Could you post your mapping file please? My first thought is
--that Product is dependent on Category, but if this were true
--you should get an error thrown. I think however, if you
--change db.begin(); db.update(p); db.commit(); To db.begin();
--db.update(c); db.commit(); Your code should work as expected
--(I think). More detail would be nice though. :)
--
---Nick
--
---------Original Message-----
----From: Henning Voss [mailto:[EMAIL PROTECTED]
----Sent: Wednesday, June 23, 2004 2:04 PM
----To: [EMAIL PROTECTED]
----Subject: [castor-user] long transaction and many-to-many
--relationships
----
----
----hi,
----
----i am having trouble with long transactions and many-to-many
----relationsships.
----i am using castor 0.9.5.3 and the example application
--against --mysql and oracle. in the example application there
--is a many --to many relationship between products and categories.
----
----sample1:
--db.begin();
--Product p = (Product)db.load(Product.class, new Integer(44));
--Category c = (Category)db.load(Category.class, new
--Integer(6)); p.addCategories(c); db.commit();
----
----sample1 runs perferctly ok, a new record is inserted into
--the --many-to-many table.
----
----sample2:
--db.begin();
--Product p = (Product)db.load(Product.class, new Integer(44));
--Category c = (Category)db.load(Category.class, new
--Integer(6)); db.commit();
----
--p.addCategories(c);
----
--db.begin();
--db.update(p);
--db.commit();
----
----sample2 does not report any errors but no new record is
----inserted into the many-to-many table.
----
----
----can someone please expain why the second sample does not work ?
----
----Thanks,
----Henning
----
----
----
---------------------------------------------------------------
----If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
---- unsubscribe castor-user
----
----
--
--
--
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-user