Hi!
tks your help I use OJB in cocoon tmocat here's the code.
this code is work on 1.0.1 but not work in 1.0.3.
public int save(Sa1 bean, Implementation impl)
{
int cnt = 0;
Database db = impl.newDatabase();
try {
db.open("sy", Database.OPEN_READ_WRITE);
Transaction tx = impl.newTransaction();
tx.begin();
OQLQuery query = impl.newOQLQuery();
query.create("select sa1s from " + Sa1.class.getName() + " where
sa1_ord = $1");
query.bind(bean.getSa1_ord());
DList result = (DList) query.execute();
cnt = result.size();
if (cnt != 0) {
Sa1 toBeEdited = (Sa1) result.get(0);
if (toBeEdited != null) {
try {
PropertyUtils.copyProperties(toBeEdited,bean);
tx.commit();
} catch (Throwable t) {}
tx.begin();
tx.lock(toBeEdited, Transaction.UPGRADE);
tx.commit();
}
else {tx.abort();}
}
else {
try {
tx.lock(bean, Transaction.WRITE);
tx.commit();
}catch (Throwable t) {}
}
db.close();
}
catch (ODMGException ex) {}
return cnt;
}
Best Regards
----- Original Message -----
From: "Armin Waibel" <[EMAIL PROTECTED]>
To: "OJB Users List" <[email protected]>
Sent: Tuesday, June 14, 2005 3:31 PM
Subject: Re: org.odmg.LockNotGrantedException
Hi Johnson,
could you please post some (pseudo) code so that I can write a test to
reproduce your locking problem. Is OJB running in a managed (e.g. using
an appServer with JTA) or non-managed environment.
If I use another session to read it ok,But the record I wrote never
change.
sounds as the record was not committed.
regards,
Armin
Johnson wrote:
Hi!
I try to upgrade my ojb in cocoon from 1.0.1 to 1.0.3.
when I save a record and then read the record(or others) the system got
an error
org.odmg.LockNotGrantedException
If I use another session to read it ok,But the record I wrote never
change.
the objectcache I use in 1.0.1 is
org.apache.ojb.broker.cache.ObjectCachePerBrokerImpl
and 1.0.3 I use the same or ObjectCacheTwoLevelImpl it read ok then write
no error(but database no record) and then read again and got the error.
is there something I'm wrong?
Best Regards
Johnson
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]