Hi,

I'm seeing some strange behaviour with many to many relationships and
sequence key generators.

I have a simple many to many relationship setup between ServicePackage
objects and Service objects.

The code to persiste the objects follows:

db.begin();

            ServicePackage sp = new ServicePackage();
            sp.setName("Service Package " + System.currentTimeMillis());

            Service s1 = new Service();
            s1.setName("Service 1 " + System.currentTimeMillis());

            Service s2 = new Service();
            s2.setName("Service 2 " + System.currentTimeMillis());

            sp.addService(s1);
            sp.addService(s2);

            db.create(sp);

         db.commit();

         db.close();

Everything appears to go fine from the java side.  However, when I query the
database I seen that my join table (service_package_service_med) I have
three (3) rows rather than the expected two rows.

The rows contain the following data:

service_package_id      service_id
1                                 0
1                                 2
1                                 3

Somehow the Castor framework in inserting an "invalid" row into my join
table... that row being the one with the zero (0) for the service_id value.

Does anyone have any idea how this could be happening?

Steve...

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

Reply via email to