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 Alessandro Di Bella <al...@eng.it> on 2003/03/07 15:32:16 UTC

Report query and proxy objects

Hi,
I just started using OJB and i'm having a problem with proxy classes. I 
want to be able to specify which are the fields to be loaded when the 
proxy object is instantiated and which one are loaded on demand. From 
the previous threads on the list i understood that it can be done with 
the so called "report queries", I have a general understanding on how to 
use them but it's still obscure to me how to integrate them with a proxy 
class.
Could someone give me some example/tutorial please?

Thanks

Alessandro


Re: Report query and proxy objects

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi alessandro,

ojb always loads object completely ! report queries do not deral with 
business objects, the simply return 'rows'.

jakob

Alessandro Di Bella wrote:

> Hi,
> I just started using OJB and i'm having a problem with proxy classes. 
> I want to be able to specify which are the fields to be loaded when 
> the proxy object is instantiated and which one are loaded on demand. 
> From the previous threads on the list i understood that it can be done 
> with the so called "report queries", I have a general understanding on 
> how to use them but it's still obscure to me how to integrate them 
> with a proxy class.
> Could someone give me some example/tutorial please?
>
> Thanks
>
> Alessandro
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>


Re: Report query and proxy objects

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

Alessandro Di Bella wrote:
> thanks this clear things a bit. Just one more thing, if i define a 
> compound key made of all the fields of my "fetch group", would i be able 
> to get their values from the proxy using 
> VirtualProxy.getPrimaryKeyValues() ?

There is a protected method VirtualProxy.getIdentity().
You could use this method in your actual Proxy implementation to obtain 
the Identity of the "real" object.
Calling Identity.getPrimaryKeyValues() returns an Object[] consisting of 
the compound primary key.

There you are!

cheers,
Thomas

> 
> Thomas Mahler wrote:
> 
>> Hi ALessandro,
>>
>> Alessandro Di Bella wrote:
>>
>>> Hi,
>>> I just started using OJB and i'm having a problem with proxy classes. 
>>> I want to be able to specify which are the fields to be loaded when 
>>> the proxy object is instantiated and which one are loaded on demand. 
>>
>>
>>
>> The solution you are looking for is not a proxy solution, but is 
>> called "fetch groups" or "partial loading". OJB does not provide 
>> declarative support for this.
>> But you could implement this mechanism on top of the existing OJB 
>> features.
>> This is possible, but not something that you should do within the 
>> first 4 weeks of using OJB...
>> The solution
>> - could include runtime manipulation of mapping data.
>> - you could juggle with different repositories that contain different 
>> mappings for the same class, one having only 2 field-decsriptors and 
>> the other containing all 17 field-descriptors.
>> - or it could be based on your own *user-defined proxy* objects
>> - it could be also to have a *preview class* and a *full data class* 
>> mapped onto the same table.
>>
>> The default *dynamic Proxy* mechanism works differently. It does not 
>> do partial loading but is based on a lazy delegation pattern.
>> Please see tutorial3.html for more details.
>>
>>> From the previous threads on the list i understood that it can be 
>>> done with the so called "report queries", I have a general 
>>> understanding on how to use them but it's still obscure to me how to 
>>> integrate them with a proxy class.
>>
>>
>>
>> Report queries do not fit into this picture. they are meant to produce 
>> tabular representation of arbitrary result sets. They circumvent the 
>> OJB object loading mechanism and thus they won't help you working with 
>> proxies.
>>
>>
>>
>> cheers,
>> Thomas
>>
>>> Could someone give me some example/tutorial please?
>>>
>>> Thanks
>>>
>>> Alessandro
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 



Re: Report query and proxy objects

Posted by Alessandro Di Bella <al...@eng.it>.
thanks this clear things a bit. Just one more thing, if i define a 
compound key made of all the fields of my "fetch group", would i be able 
to get their values from the proxy using 
VirtualProxy.getPrimaryKeyValues() ?

Thomas Mahler wrote:

> Hi ALessandro,
>
> Alessandro Di Bella wrote:
>
>> Hi,
>> I just started using OJB and i'm having a problem with proxy classes. 
>> I want to be able to specify which are the fields to be loaded when 
>> the proxy object is instantiated and which one are loaded on demand. 
>
>
> The solution you are looking for is not a proxy solution, but is 
> called "fetch groups" or "partial loading". OJB does not provide 
> declarative support for this.
> But you could implement this mechanism on top of the existing OJB 
> features.
> This is possible, but not something that you should do within the 
> first 4 weeks of using OJB...
> The solution
> - could include runtime manipulation of mapping data.
> - you could juggle with different repositories that contain different 
> mappings for the same class, one having only 2 field-decsriptors and 
> the other containing all 17 field-descriptors.
> - or it could be based on your own *user-defined proxy* objects
> - it could be also to have a *preview class* and a *full data class* 
> mapped onto the same table.
>
> The default *dynamic Proxy* mechanism works differently. It does not 
> do partial loading but is based on a lazy delegation pattern.
> Please see tutorial3.html for more details.
>
>> From the previous threads on the list i understood that it can be 
>> done with the so called "report queries", I have a general 
>> understanding on how to use them but it's still obscure to me how to 
>> integrate them with a proxy class.
>
>
> Report queries do not fit into this picture. they are meant to produce 
> tabular representation of arbitrary result sets. They circumvent the 
> OJB object loading mechanism and thus they won't help you working with 
> proxies.
>
>
>
> cheers,
> Thomas
>
>> Could someone give me some example/tutorial please?
>>
>> Thanks
>>
>> Alessandro
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>



partial loading / proxies

Posted by Joerg Lensing <in...@softcon-lensing.de>.
Hi Thomas,
in your mail to Alessandro Di Bella (7.3.2003) you write:

> Alessandro Di Bella wrote:
>
>> Hi,
>> I just started using OJB and i'm having a problem with proxy classes. 
>> I want to be able to specify which are the fields to be loaded when 
>> the proxy object is instantiated and which one are loaded on demand. 
>
Thomas wrote:

> The solution you are looking for is not a proxy solution, but is 
> called "fetch groups" or "partial loading". OJB does not provide 
> declarative support for this.
> But you could implement this mechanism on top of the existing OJB 
> features.
> This is possible, but not something that you should do within the 
> first 4 weeks of using OJB...
> The solution
> - could include runtime manipulation of mapping data.
> - you could juggle with different repositories that contain different 
> mappings for the same class, one having only 2 field-decsriptors and 
> the other containing all 17 field-descriptors.
> - or it could be based on your own *user-defined proxy* objects
> - it could be also to have a *preview class* and a *full data class* 
> mapped onto the same table.

My question:  which of these four solutions would you prefer and why?
the preview-solution seems to be the easiest. I tried it, but i had 
problems with it (some problems with extend).
The hierarchy is:

basePO (abstract)
    |-partnerPO (abstract)
             |-personPO
             |-organisationPO

-The preview-class should be able to read fields from all three classes
-all classes may have collections of  additional classes (e.g. address)

any hints?

vm tx
joerg








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


Re: Report query and proxy objects

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

Alessandro Di Bella wrote:
> Hi,
> I just started using OJB and i'm having a problem with proxy classes. I 
> want to be able to specify which are the fields to be loaded when the 
> proxy object is instantiated and which one are loaded on demand. 

The solution you are looking for is not a proxy solution, but is called 
"fetch groups" or "partial loading". OJB does not provide declarative 
support for this.
But you could implement this mechanism on top of the existing OJB features.
This is possible, but not something that you should do within the first 
4 weeks of using OJB...
The solution
- could include runtime manipulation of mapping data.
- you could juggle with different repositories that contain different 
mappings for the same class, one having only 2 field-decsriptors and the 
other containing all 17 field-descriptors.
- or it could be based on your own *user-defined proxy* objects
- it could be also to have a *preview class* and a *full data class* 
mapped onto the same table.

The default *dynamic Proxy* mechanism works differently. It does not do 
partial loading but is based on a lazy delegation pattern.
Please see tutorial3.html for more details.

> From 
> the previous threads on the list i understood that it can be done with 
> the so called "report queries", I have a general understanding on how to 
> use them but it's still obscure to me how to integrate them with a proxy 
> class.

Report queries do not fit into this picture. they are meant to produce 
tabular representation of arbitrary result sets. They circumvent the OJB 
object loading mechanism and thus they won't help you working with proxies.



cheers,
Thomas

> Could someone give me some example/tutorial please?
> 
> Thanks
> 
> Alessandro
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
>