Blazebit / blaze-persistence

Rich Criteria API for JPA providers
https://persistence.blazebit.com
Apache License 2.0
741 stars 90 forks source link

Exception thrown when using subQuery + pagedList #1908

Open test-bin-001 opened 5 months ago

test-bin-001 commented 5 months ago

Description

This problem occurs when I query page in a subquery, and only when the dialect is oracle

Actual behavior

Caused by: java.sql.SQLException: 无效的列索引
    at oracle.jdbc.driver.OraclePreparedStatement.setIntInternal(OraclePreparedStatement.java:4955)
    at oracle.jdbc.driver.OraclePreparedStatement.setInt(OraclePreparedStatement.java:4946)
    at oracle.jdbc.driver.OraclePreparedStatementWrapper.setInt(OraclePreparedStatementWrapper.java:201)
    at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.setInt(HikariProxyPreparedStatement.java)
select * from (select u1_0.id,u1_0.name,(select count(*) from (select null id,null name  from dual where 1=0 union all (select u1_0.id,u1_0.name from user_test u1_0 where u1_0.id is not null group by u1_0.id,u1_0.name)) u2_0) from (select null id,null name  from dual where 1=0 union all (select u1_0.id,u1_0.name from user_test u1_0 where u1_0.id is not null group by u1_0.id,u1_0.name)) u1_0 order by u1_0.id) where rownum<=?

Steps to reproduce

QUser user = QUser.user;
JPQLNextQueryFactory queryFactory = new BlazeJPAQueryFactory(entityManager, criteriaBuilderFactory);
var userPagedList = queryFactory.select(user).from(select(user).from(user).where(user.id.isNotNull()), user)
        .orderBy(user.id.asc())
        .fetchPage(0, 10);
Assertions.assertNotNull(userPagedList);

Environment

Version: 1.6.9 JPA-Provider: Hibernate 6.2.5.Final DBMS: Oracle 11g Application Server: Spring Boot

beikov commented 3 months ago

Can you translate the error message to English maybe?

Also, Oracle 11 is not supported anymore and Blaze-Persistence does not provide support for that version either. Please upgrade to the latest supported Oracle version.