Hi,

We have been using the same pagination pattern on Oracle as Cayenne uses
without problems for quite some time (years). So I can confirm that it looks
sane.

Anyway looking at the query in CAY-1266, one thing sticks out - The inner
query returns both t0.docid and t1.docid, IIRC oracle will "translate" the
latter into "docid_1" if the inner sql is executed without the wrapper
clauses.

It just doesn't make sense to return "docid" twice from the select clause as
you can't really distinguish them in the surrounding sql anyway (but the
inner query is able to execute as valid sql due to the naming trick and as
it is the join column it doesn't matter if we're getting the t0 or t1
version here).

The solutions I can come up with at the moment would be to alias the columns
in a way that ensures unique column names: select ...., t0.docid t0_docid,
..., t1.docid t1_docid FROM ... (That would make Oracle happy)

- And then let the mapper figure out what goes where (if possible?) i.e.
mapping t1_docid to the T1Object.docid and t0_docid to the T0Object.docid  -
Exactly what Brunos colleague suggests.

Alternatively a quick partial solution is to leave out the t1.<column_name>,
if: 1) it is a join column and 2) it has same name as t0.<column_name> -
duplicated column names that are NOT joined on, will still give errors with
this, but the mapping code would not need to adapt to the aliased column
names.

Aliasing the columns (first suggestion) will be the most robust/correct
solution as queries returning tables with equivalently named non-join
columns would return incorrect results. Although the quick hack could be
used to figure out if the above analysis is correct ;)

I hope this helps you guys figure out a solution to Oracle/fetch limit
thing.

-- 
Regards Chris



On Tue, Jun 14, 2011 at 5:02 PM, Bruno René Santos <brunor...@holos.pt>wrote:

> I've just found the issue 
> https://issues.apache.org/**jira/browse/CAY-1266<https://issues.apache.org/jira/browse/CAY-1266>that
>  reveals the same situation I have. Any news about fixing this? A
> coleague of mine told me it was a matter of assigning an different alias for
> each column (table alias + name maybe?) and that way oracle would be able to
> distinguish all columns. Is that feasible? How could I do this change if
> anybody else do not have the time?
>
> Thanx a lot
> Bruno
>
>
> Em 02-06-2011 14:30, Bruno René Santos escreveu:
>
>  Yes a regular SelectQuery, with some Expressions possibly
>>
>> Bruno
>>
>> Em 02-06-2011 14:23, Andrus Adamchik escreveu:
>>
>>> On Jun 2, 2011, at 4:04 PM, Bruno René Santos wrote:
>>>
>>>        query.setFetchLimit(count);
>>>>
>>> Just to clarify - which type of Query? SelectQuery?
>>>
>>> Andrus
>>>
>>>
>>
>>
>
> --
> Bruno René Santos | brunor...@holos.pt <mailto:brunor...@holos.pt> |
> Gestor de Projectos | Analista | Programador | Investigador
>
> Holos - Soluções Avançadas em Tecnologias de Informação S.A.
> Parque de Ciência e Tecnologia de Almada/Setúbal . Edifício Madan Parque
> Rua dos Inventores . Quinta da Torre . 2825 - 182 Caparica . Portugal
> Phone: +351 210 438 686 . Fax: +351 210 438 687 . Web: www.holos.pt
>
>
> This email and any files transmitted with it are confidential and intended
> solely for the use of the individual or entity to whom they are addressed.
> If you are not the intended recipient or the person responsible for
> delivering the email to the intended recipient, be advised that you have
> received this email in error and that any use, dissemination, forwarding,
> printing, or copying of this email is strictly prohibited. If you have
> received this email in error please notify Bruno René Santos by telephone on
> +351 210 438 686
>
>

Reply via email to