Hi list,

Before all,  thanks to the people who gave me answers very quickly.

Actually, I try to use all of the basics features of Castor JDO.
I have recently encountered a problem with the many-to-many relation :
 - When I want to add an object  (Class Item) to an existing other object
(Class  Channel), the insert is done in the Database (table Item) but the
association table doesn't take care of the changes.

As an example :

public void updateChannel(Channel channel) {

database.begin();
_channel
= (Channel)database.load(com.ibm.essonnes.castor.jdoTestSuite.rssDef.Channel.class,new

Integer(channel.getId()));
...
if (!channel.getItems().isEmpty()) {
      Enumeration enum = channel.getItems().elements();
      Items items = new Vector();
      while (enum.hasMoreElements()) {
            item = (Item)enum.nextElement();
            item.setChannel(_channel);
            items.add(item);
            }
      _channel.setItems(items);
}
...
database.commit();


I've done the things work this way because it works fine with a 1-n
relation.

Can someone reply me what I've done wrong?

Notes :
Deleting an Item from a Channel works (i.e the association table has
deleted one row)
No dependency is made between Channel and Item.


Thanks by advance,
Regards,
Pascal.

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

Reply via email to