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 Maarten Coene <Ma...@qmedit.com> on 2003/02/25 14:27:23 UTC

some OJB proxy questions

Hi,

I have a couple of questions about the proxies.

1. I want to use dynamic proxies, but these proxies may not use the 
PersistenceBroker for querying the database. Instead, they must get the 
real object through an API I defined myself. The idea is to return object 
from my object model to clients, but these clients cannot access the 
database directly, they must use a specific component. This means that if I 
return proxies, these proxies must also use that component.

More concrete: the dynamic proxy wil do something like this to retrieve the 
object:

if (realObject == null) {
     realObject = broker.getObjectByIdentity(id);
}

But I want this to be:

if (realObject == null) {
      realObject = myComponent.getObject(id);
}

Is it possible to do this with dynamic proxies? I know I can define my own 
proxy for each class from the object model, but using dynamic proxies would 
save me a lot of work.



2. If the above problem is not possible with dynamic proxies, is it 
possible to define my own proxy-class for proxy for a reference? It looks 
to me that the reference-descriptor element only allows the use of dynamic 
proxies for this purpose?

I want to do something like this:

<reference-descriptor
          name="productGroup"
          class-ref="org.apache.ojb.broker.ProductGroup"
          proxy="true"
          proxy-class="com.MyProxy" >




regards,
Maarten Coene 



Re: some OJB proxy questions

Posted by Thomas Mahler <th...@web.de>.
Hi Maarten,

AFAIK this is not possible today.
But I think it's a feature request that could be beneficial for several 
users. I also believe that is not that difficult to implement.

It won't make it into 1.0, but we can place it on the post 1.0 roadmap.

For the time being you could try to use instance call-backs and use the 
onLoad callback to fill reference and collections attributes with your 
proxy objects.

cheers,
Thomas

Maarten Coene wrote:
> Hi,
> 
> I have a couple of questions about the proxies.
> 
> 1. I want to use dynamic proxies, but these proxies may not use the 
> PersistenceBroker for querying the database. Instead, they must get the 
> real object through an API I defined myself. The idea is to return 
> object from my object model to clients, but these clients cannot access 
> the database directly, they must use a specific component. This means 
> that if I return proxies, these proxies must also use that component.
> 
> More concrete: the dynamic proxy wil do something like this to retrieve 
> the object:
> 
> if (realObject == null) {
>     realObject = broker.getObjectByIdentity(id);
> }
> 
> But I want this to be:
> 
> if (realObject == null) {
>      realObject = myComponent.getObject(id);
> }
> 
> Is it possible to do this with dynamic proxies? I know I can define my 
> own proxy for each class from the object model, but using dynamic 
> proxies would save me a lot of work.
> 
> 
> 
> 2. If the above problem is not possible with dynamic proxies, is it 
> possible to define my own proxy-class for proxy for a reference? It 
> looks to me that the reference-descriptor element only allows the use of 
> dynamic proxies for this purpose?
> 
> I want to do something like this:
> 
> <reference-descriptor
>          name="productGroup"
>          class-ref="org.apache.ojb.broker.ProductGroup"
>          proxy="true"
>          proxy-class="com.MyProxy" >
> 
> 
> 
> 
> regards,
> Maarten Coene
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
>