You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Stefan Schlösser <ss...@intermediate.de> on 2004/03/16 10:20:53 UTC
AfterLookup in PersistenceBrokerAware called with incomplete Object
(reference Missing) ?
Hi,
we have a situation in which an object A contains another object B
defined by a ReferenceDiscriptor.
The afterLookup method of A is called even though the object B inside
object A is null. It seems to us that the calling sequence has changed
that afterLokkup is called before the retrieval/Materialization of B
takes place.
Here is A descriptor of B:
<reference-descriptor name="addressValue"
class-ref="de.iqu.connector.valueobj.MAS90AddressValue"
auto-retrieve="true">
We have been checking the sqls generated and it seems that the proper
lookup sqls for B are generated and do have a result set.
We have been debugging ojb and found the following behavior in
QueryReferenceBroker:
method public void retrieveReference(Object obj, ClassDescriptor cld,
ObjectReferenceDescriptor rds, boolean forced)
line 351 else if ((m_retrievalTasks != null) && !rds.isLazy()
&& (rds.getItemProxyClass() == null))
{
addRetrievalTask(obj, rds);
isRefObjDefined = false;
}
where the else block evaluates to true for the reference in question.
This seems to result that the afterLookup method is called before the
object has been retrieved since in method
private ManageableCollection getCollectionByQuery(Class
collectionClass, Class itemClass, Query query)
throws ClassNotPersistenceCapableException,
PersistenceBrokerException
The afterLookup is called in line 147
Object candidate = iter.next();
and the method performRetrievalTasks(); only in line 187.
Any ideas on whether this is true, why ojb behaves like that and what
can be done to make ojb call the afterLookup method only until after all
references have been loaded?
By the way, we use ojb RC5, everything did work fine with ojb 0.9.8.
Thanks,
S.Schlösser
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: AfterLookup in PersistenceBrokerAware called with incomplete
Object (reference Missing) ?
Posted by Armin Waibel <ar...@apache.org>.
Hi Stefan,
did you tried latest from CVS?
We made several changes in code since rc5.
If it doesn't work with latest from CVS too, a test case would be really
helpful.
regards,
Armin
Stefan Schlösser wrote:
> Hi,
>
> we have a situation in which an object A contains another object B
> defined by a ReferenceDiscriptor.
>
> The afterLookup method of A is called even though the object B inside
> object A is null. It seems to us that the calling sequence has changed
> that afterLokkup is called before the retrieval/Materialization of B
> takes place.
> Here is A descriptor of B:
> <reference-descriptor name="addressValue"
> class-ref="de.iqu.connector.valueobj.MAS90AddressValue"
> auto-retrieve="true">
>
> We have been checking the sqls generated and it seems that the proper
> lookup sqls for B are generated and do have a result set.
> We have been debugging ojb and found the following behavior in
> QueryReferenceBroker:
>
> method public void retrieveReference(Object obj, ClassDescriptor cld,
> ObjectReferenceDescriptor rds, boolean forced)
>
> line 351 else if ((m_retrievalTasks != null) && !rds.isLazy()
> && (rds.getItemProxyClass() == null))
> {
> addRetrievalTask(obj, rds);
> isRefObjDefined = false;
> }
> where the else block evaluates to true for the reference in question.
>
> This seems to result that the afterLookup method is called before the
> object has been retrieved since in method
> private ManageableCollection getCollectionByQuery(Class
> collectionClass, Class itemClass, Query query)
> throws ClassNotPersistenceCapableException,
> PersistenceBrokerException
>
> The afterLookup is called in line 147
> Object candidate = iter.next();
>
> and the method performRetrievalTasks(); only in line 187.
>
>
> Any ideas on whether this is true, why ojb behaves like that and what
> can be done to make ojb call the afterLookup method only until after all
> references have been loaded?
>
> By the way, we use ojb RC5, everything did work fine with ojb 0.9.8.
>
> Thanks,
>
> S.Schlösser
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org