Hi,

When a execute the code below it does not insert Sito(2) and I get the error

[org.apache.ojb.odmg.TransactionImpl] WARN: Abort transaction was called on
tx org.apache.ojb.odmg.TransactionImpl@40c281, associated PB was null

when I execute the abort.

I am using MySQL and Serializable isolation property.

What am I doing wrong?

Thanks in advance,
Ant�nio


    public Application() {
        Implementation odmg = OJB.getInstance();
        Database db = odmg.newDatabase();
        try {
            db.open("ServidorPersistente/OJB/repository.xml",
Database.OPEN_READ_WRITE);
        } catch (ODMGException ex) {
        }

        // create an object
        newSitio(1);
        // create the same object - fails on commit and then fails on
catch/abort
        newSitio(1);
        // create a different object - fails, does not create the object...
        newSitio(2);
    }

    private void newSitio(int value) {
        Implementation odmg = OJB.getInstance();
        Transaction tx = odmg.newTransaction();
        try {
            ISitio sitio = null;
            tx.begin();
            sitio = new Sitio(value);
            tx.lock(sitio, tx.WRITE);
            tx.commit();
        } catch (Exception ex) {
            try {
                tx.abort();
            } catch (Exception exx) {
            }
        }
    }

    public static void main(String [] args) {
        Application app = new Application();
    }


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to