{
long timestamp = System.currentTimeMillis();
String name = "testMultipleLocks_" + timestamp;
String nameUpdated = "testMultipleLocks_Updated_" + timestamp;
TransactionExt tx = (TransactionExt) odmg1.newTransaction();
LockedByVersion obj = new LockedByVersion();
tx.begin();
tx.lock(obj, Transaction.WRITE);
obj.setValue(name);
tx.lock(obj, Transaction.WRITE);
tx.lock(obj, Transaction.UPGRADE);
tx.commit();
OQLQuery query = odmg1.newOQLQuery();
query.create("select all from " + LockedByVersion.class.getName() + " where value like $1");
query.bind(name);
Collection result = (Collection) query.execute();
assertNotNull(result);
assertEquals(1, result.size());
tx.begin();
tx.lock(obj, Transaction.WRITE);
tx.lock(obj, Transaction.WRITE);
obj.setValue(nameUpdated);
tx.lock(obj, Transaction.WRITE);
tx.lock(obj, Transaction.UPGRADE);
tx.commit();
query = odmg1.newOQLQuery();