Hi.
I've been testing the CVS version of OJB to solve a problem we have with
one of our applications. It seems that in memory locking is not working
properly. Here's some trivial test case.
package com.whatever;
import java.util.List;
import junit.framework.*;
import org.apache.ojb.odmg.OJB;
import org.odmg.Database;
import org.odmg.Implementation;
import org.odmg.OQLQuery;
import org.odmg.Transaction;
public class PersistenciaTest extends TestCase {
public PersistenciaTest(String testName) {
super(testName);
}
public void testOJB() throws Exception {
Implementation ojb = (Implementation) OJB.getInstance();
Database db = ojb.newDatabase();
db.open("myalias#user#pass", Database.OPEN_READ_WRITE);
Transaction tx = ojb.newTransaction();
tx.begin();
OQLQuery query = ojb.newOQLQuery();
query.create("select o from com.whatever.MyClass where id = 1");
List lista = (List) query.execute();
if (lista.size() > 0) {
Object obj = lista.get(0);
assertNotNull(obj);
tx.lock(obj, Transaction.WRITE);
}
query = ojb.newOQLQuery();
query.create("select o from com.whatever.MyClass where id1 = 1");
lista = (List) query.execute();
if (lista.size() > 0) {
Object obj = lista.get(0);
assertNotNull(obj);
tx.lock(obj, Transaction.WRITE); // HERE should throw
LockNotGrantedException but does not
}
tx.abort();
db.close();
}
protected void setUp() throws Exception {
}
protected void tearDown() throws Exception {
}
}
To get things worse, in 1.0.3 locking works fine with WRITE, but if I
try to acquire a READ lock it behaves as it were WRITE, so I get
LockNotGrantedException.
I'm using read-uncommitted level isolation.
Thank you.
--
José María
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]