db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert S. Sfeir" <rob...@codepuccino.com>
Subject Re: [PFE] fetching proxy's identities
Date Sat, 20 Dec 2003 16:05:40 GMT
I'm not a commiter, but +1 from here.  I've always favored defining the 
colums you want to get v/s select *.  The issue I think it going to be 
that often we pass in a bean which contains all the columns regardless, 
so we'd need to specify which bean properties we want to fetch as part 
of the Query, something like:

crit.addLike( "upper(name)", "%" + acronymName.toUpperCase() + "%" );

would do select * for the name.  We should have something which would 
let us also add to the criteria:

String cols[] = {"id, name, description"};
crit.addReturnColumns(cols);

or

crit.addReturnColumn("id");
crit.addReturnColumn("name");
crit.addReturnColumn("description");

which would turn into

select id, name, descrition from table where name=...

of course you'd also have to handle joins and group by properly, which 
can make this for pretty hairy code, but most likely more efficient.

R

Oleg Nitz wrote:

>Hi All,
>
>I noticed that when OJB loads proxy objects, it fetches all columns from 
>database, but then uses only few of them to build the Identity.
>Is there any reasons for this?
>I think this is rather inefficient, I propose to fetch only those columns that 
>object's identity consists of. I understand that this means quite many 
>changes to core classes, so this optimisation should be for 1.1 version of 
>OJB, not for 1.0
>What do you think?
>
>Oleg
>
>---------------------------------------------------------------------
>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