ofbiz-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michał Cukierman <mcukier...@partbook.eu>
Subject Re: Groovy question regarding passing html parameters
Date Fri, 20 Aug 2010 13:58:26 GMT
Scott,

Maybe I am wrong but ... EntityOperator.IN is used to filter objects
that you already have. From the developer point of view it's very bad
practice.

For example:
1) You need to query for 1000 products
2) You use EntityOperator and do a second query to "filter" those, just
to get ,lets say, 10 products as a result.

You can do it within a single query (not two of them), and you can fetch
just 10 objects from a database not 1010.

It's complitely OK If you already have objects passed after
EntityOperator.IN in a java collection, but in this case:
You need to do it specialy for creating second DB call.

There should be a method for doing sth like:
EntityCondition.makeCondition("shipmentId", EntityOperator.IN,
CustomWhereCondition). 
There should be extended methods for making joins.
As long as those do not exist - we should at least try use PROPER SQL
calls.

>>From my perspective, Ofbiz is much more limited 'cause of such code.

Regards,
Michał



Dnia 2010-08-20, pią o godzinie 23:27 +1200, Scott Gray pisze:
> Hi Pierre,
> 
> You'll want to use delegator.findList(...) with an EntityOperator.IN condition for the
experience field.
> 
> Regards
> Scott
> 
> HotWax Media
> http://www.hotwaxmedia.com
> 
> On 20/08/2010, at 10:31 PM, Pierre Smits wrote:
> 
> > In a url I pass following parameters:
> > 
> > ?profile=10000&experience=10000,100010
> > 
> > In a groovy file I get the parameters....
> > parameter.profile
> > parameter.experience
> > 
> > My question is: how do I get the delegator to find entities in the database
> > based on both parameter.profile and parameter.experience?
> > 
> > In all the other codes in groovy files that I see it seems that parameters
> > have only 1 value... Or I might be overlooking one...
> > 
> > Regards,,
> > 
> > Pierre
> 


Mime
View raw message