You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Wara Songkran <pa...@yahoo.com> on 2003/05/24 11:02:46 UTC

ODMG api with m:n mapping.

I'm working on non-decomposed m:n mapping. My code is 

---------PersistenceBroker----------------

        Car c = new Car();
        Cylinder s = new Cylinder();

        Collection col = new ArrayList();
        col.add(s);

        c.setAllSpareparts(col);
        broker.store(c);

----------ODMG-----------------------------

        Transaction tx = null;

        Car c = new Car();
        Cylinder s = new Cylinder();

        Collection col = new ArrayList();
        col.add(s);

        c.setAllSpareparts(col);

        try {
            tx = odmg.newTransaction();
            tx.begin();

            tx.lock(c,Transaction.WRITE);
            tx.commit();
        } catch (LockNotGrantedException e) {
            e.printStackTrace();
        }

when I use PresistenceBroker it's work fine but with
odmg  api it cause error.

[org.apache.ojb.odmg.ObjectEnvelopeTable] ERROR:
Commit on object level failed for tx
org.apache.ojb.odmg.TransactionImpl@1a082e2
Invalid argument value: Duplicate entry '121' for key
1

I'm using mysql and all table is InnoDB.

please help.


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com