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 Kirill Petrov <KP...@uci.edu> on 2005/04/12 07:49:48 UTC

partial materialization?..

Hello everybody,

I have a database that has very complex objects called Models. From time 
to time I need to present the user only with the names of those models. 
Since I don't want to instantiate every model only for that, I used 
dynamic proxies for all the classes that comprise a particular Model 
object.

However, sometimes, I need to intantiate a whole model, serialize it and 
send it through the web service. In this case, if I just get a model 
from the database and send it over the wire, I end up sending a bunch of 
proxy objects instead of a real model.

What's the right solution for this problem?

Kirill


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


Re: partial materialization?..

Posted by Stas Ostapenko <st...@gmail.com>.
Using of Report Queries may help, I think.

>From /doc/site.html#Report+Queries :

Report queries are used to retrieve row data, not 'real' business
objects. A row is an array of Object. With these queries you can
define what attributes of an object you want to have in the row. The
attribute names may also contain path expressions like
'owner.address.street'. To define the attributes use ReportQuery
#setAttributes(String[] attributes).

The following ReportQuery retrieves the name of the ProductGroup, the
name of the Article etc. for all Articles named like "C%":

Criteria crit = new Criteria();
Collection results = new Vector();
crit.addLike("articleName", "C%");
ReportQueryByCriteria q = QueryFactory.newReportQuery(Article.class, crit);
q.setAttributes(new String[] { "productGroup.groupName","articleId",
"articleName", "price" });

Iterator iter = broker.getReportQueryIteratorByQuery(q);

The ReportQuery returns an Iterator over a Collection of Object[4]
([String, Integer, String, Double]).

On Apr 12, 2005 8:49 AM, Kirill Petrov <KP...@uci.edu> wrote:
> Hello everybody,
> 
> I have a database that has very complex objects called Models. From time
> to time I need to present the user only with the names of those models.
> Since I don't want to instantiate every model only for that, I used
> dynamic proxies for all the classes that comprise a particular Model
> object.
> 
> However, sometimes, I need to intantiate a whole model, serialize it and
> send it through the web service. In this case, if I just get a model
> from the database and send it over the wire, I end up sending a bunch of
> proxy objects instead of a real model.
> 
> What's the right solution for this problem?
> 
> Kirill
> 
> ---------------------------------------------------------------------
> 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