When you deal with non-traditional data store formats (ODBMS, XML, JCR etc), 
you need to think a little out of the box.  One way is model your structures 
such that you store additional information as separate (or embedded) 
structures.  A simple technique would be to store separately the min/max values 
that are updated as appropriate on each save to the data store.  When you model 
your data, keep in mind strengths/limitations of the underlying storage 
technology and design accordingly.

Rakesh
 
On 12 Jan 2010, at 06:59, Peter Dotchev wrote:

> 
> Hi Alex,
> 
> If I understand you correctly, that would mean a separate query for each
> product and if I have hundreds or thousands of products ... that doesn't
> look very nice.
> 
> Regards,
> Peter
> 
> 
> Alexander Klimetschek wrote:
>> 
>> On Mon, Jan 11, 2010 at 09:59, Peter Dotchev <[email protected]> wrote:
>>> Now, I want to get a list of products including the lowest price for each
>>> product.
>>> I don't see MIN/MAX mentioned in JCR 2.0 spec, so it seems they are not
>>> support by repository queries. :(
>>> 
>>> What approach would you recommend to fetch such a list from the
>>> repository.
>> 
>> You can query all products and order by price, eg. in xpath something like
>> this:
>> 
>> //*...@product='myproduct'] order by @price
>> 
>> with ascending or descending at the end, depending on the order. Only
>> reading the first element from the result should be enough ;-)
>> 
>> Regards,
>> Alex
>> 
>> -- 
>> Alexander Klimetschek
>> [email protected]
>> 
>> 
> 
> -- 
> View this message in context: 
> http://n4.nabble.com/min-max-query-tp1011086p1012075.html
> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Rakesh Vidyadharan
President & CEO
Sans Pareil Technologies, Inc.
http://sptci.com/


| 100 W. Chestnut, Suite 1305 | Chicago, IL 60610-3296 USA |
| Ph: +1 (312) 212 3933 | Mobile: +1 (312) 315-1596 (US), +91  949 611 0873 
(IN) | Fax: +1 (312) 276-4410 | E-mail: [email protected]




Reply via email to