db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Armin Waibel <ar...@code-au-lait.de>
Subject Re: retrieve object inside delete
Date Mon, 03 Nov 2003 13:54:43 GMT
Hi Olli,

correct me if I'm wrong:
You lookup a proxy object and then call
broker.delete(proxyObject)
right?
I assume the select statement is the result of

obj = ProxyHelper.getRealObject(obj);

How can we avoid this? Assume the proxy object
reference other objects and all have auto-delete 'true'...

regards,
Armin

oliver.matz@ppi.de wrote:

> Hello,
> 
> IMHO it is not possible with OJB to delete an object
> without rertieving it before.
> 
> I tried to instantiate a Proxy x and then call
> PersistenceBrokerImpl.delete(x),
> but this results in two statements: 
> 
> SELECT ... FROM XTABLE WHERE UID=4711
> DELETE FROM XTABLE WHERE UID=4711
> 
> obviously, the first statement is superflous.
> 
> The reason for its generation is the following 
> (from PersistenceBrokerImpl.delete())
> 
> 
> public void delete(Object obj) throws PersistenceBrokerException
> {
>   if (obj != null)
>   {
>     obj = ProxyHelper.getRealObject(obj);
>            /**
>              * MBAIRD
>              * 1. if we are marked for delete already, avoid recursing on
> this object
>              *
>              * arminw:
>              * use object instead Identity object in markedForDelete List,
>              * because using objects we get a better performance. I can't
> find
>              * side-effects in doing so.
>              */
>     if (markedForDelete.contains(obj))
>     {
>       return;
>     }
> 
> ....
> 
> The first statement results in the superflous select.
> 
> Armin, reading your comment it seems that that behaviour once was
> different.  Do you agree? 
> 
> Is it possible to save the unneccessary SELECT?
> 
> Olli
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 
> 



---------------------------------------------------------------------
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