db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <joerg.heini...@gmx.de>
Subject Re: [OTM] NPE on OTMConnection.refresh(object)
Date Wed, 19 May 2004 21:45:55 GMT
On 19.05.2004 23:37, Oleg Nitz wrote:
> Hi Jeorg,
> 
> I guess the object was retrieved in some transaction A, 
> and you refresh it in another transaction B.

Yes, definitely. And that's not a use case for refresh()?

As a work around at the moment I do

Creditor c = 
conn.getObjectForIdentity(conn.getIdentityForObject(legalcase.getCreditor()));
legalcase.setCreditor(c);

where I thought simply

conn.refresh(legalcase.getCreditor());

would work.

Joerg

> On Wednesday 19 May 2004 17:40, Joerg Heinicke wrote:
> 
>>When refreshing an already persistent object, that also has been retrieved
>>from db, I get an NPE:
>>
>>java.lang.NullPointerException
>>at org.apache.ojb.otm.core.ConcreteEditingContext.
>>                           refresh(ConcreteEditingContext.java:826)
>>at org.apache.ojb.otm.core.BaseConnection.
>>                           refresh(BaseConnection.java:377)
>>at com.ewerk.erak.db.ojb.otm.
>>                    
>>LegalcaseDAOImpl.updateLegalcase(LegalcaseDAOImpl.java:132)
>>
>>In ConcreteEditingContext.refresh()
>>
>>public void refresh(Identity oid, Object object)
>>{
>>    ContextEntry entry = (ContextEntry) _objects.get(oid);
>>    Object[][] origFields = (Object[][]) _original.get(oid);
>>    if (origFields != null)
>>    {
>>        setFields(entry.userObject, origFields);
>>        if (object != entry.userObject)
>>        {
>>            setFields(object, origFields);
>>        }
>>    }
>>    entry.state = entry.state.refresh();
>>}
>>
>>the local variable entry is null. Even worse the HashMap _objects it self
>>is empty. How can this be possible at all?
>>
>>Joerg

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message