SQLQueryFactory .list() with offset and limit causes SQLSyntaxErrorException in Oracle11g #1445

Closed
sarababaei opened this Issue Jul 21, 2015 · 0 comments

Projects

None yet

2 participants

@sarababaei

Code:

QBean<ClearingSetup> clearingSetupQBean = Projections.bean(ClearingSetup.class, qTbClearingSetup.code, qTbClearingSetup.title, qTbClearingSetup.parameterValue);

public List<ClearingSetup> findAllClearingSetups() {
        return sqlQueryFactory.from(qTbClearingSetup)
                .orderBy(qTbClearingSetup.code.desc())
                .limit(3)
                .offset(2)
                .transform(GroupBy.groupBy(qTbClearingSetup.code).list(clearingSetupQBean));
 }

ClearingSetup is a sample type...
qTbClearingSetup is a sample Querydsl query type

Error:
throws com.querydsl.core.QueryException: Caught SQLSyntaxErrorException
causing "ORA-00918: column ambiguously defined" at Oracle level.

without limit and offset, it works correct.
Version: querydsl-core,querydsl-sql : 4.0.2

Full trace:

com.querydsl.core.QueryException: Caught SQLSyntaxErrorException for select * from (
select a.*, rownum rn from (
select TB_CLEARING_SETUP.CODE, TB_CLEARING_SETUP.CODE, TB_CLEARING_SETUP.TITLE, TB_CLEARING_SETUP.PARAMETER_VALUE
from CHK.TB_CLEARING_SETUP TB_CLEARING_SETUP
order by TB_CLEARING_SETUP.CODE desc
) a) where rn > 2 and rownum <= 3
at com.querydsl.sql.DefaultSQLExceptionTranslator.translate(DefaultSQLExceptionTranslator.java:50)
at com.querydsl.sql.Configuration.translate(Configuration.java:451)
at com.querydsl.sql.AbstractSQLQuery.iterateSingle(AbstractSQLQuery.java:315)
at com.querydsl.sql.AbstractSQLQuery.iterate(AbstractSQLQuery.java:247)
at com.querydsl.core.group.GroupByList.transform(GroupByList.java:53)
at com.querydsl.core.group.GroupByList.transform(GroupByList.java:36)
at com.querydsl.core.support.FetchableQueryBase.transform(FetchableQueryBase.java:55)

@timowest timowest added the progress label Jul 21, 2015
@Shredder121 Shredder121 closed this in #1450 Jul 30, 2015
@timowest timowest removed the progress label Jul 31, 2015
@timowest timowest added this to the 4.0.3 milestone Jul 31, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment