-
Notifications
You must be signed in to change notification settings - Fork 100
Closed
Labels
component: corekind: bugworth: highImplementing this has a high worthImplementing this has a high worth
Milestone
Description
Description
Trying to use the limit feature on an entity view with Hibernate's @Where
annotation fails.
Expected behavior
No exception.
Actual behavior
Executing the query fails. Example:
2023-03-03 15:11:26,142 WARN [org.hib.eng.jdb.spi.SqlExceptionHelper] (executor-thread-0) SQL Error: 0, SQLState: 42601
2023-03-03 15:11:26,143 ERROR [org.hib.eng.jdb.spi.SqlExceptionHelper] (executor-thread-0) ERROR: syntax error at or near "fileentity0_"
Position: 680
2023-03-03 15:11:26,145 SEVERE [com.bla.per.int.hib.bas.HibernateExtendedQuerySupport] (executor-thread-0) Could not execute the following SQL query: select fileentity0_.id as col_0_0_, fileentity0_.extension as col_1_0_, fileversio1_.id as col_2_0_, fileentity0_.mime_type as col_3_0_, fileentity0_.name as col_4_0_, (select count(*) from filesystem_file_version fileversio3_ where fileversio3_.file_id=fileentity0_.id) as col_5_0_, fileentity0_.path as col_6_0_, fileversio1_.id as id1_17_, fileversio1_.comment as comment2_17_, fileversio1_.created_at as created_3_17_, fileversio1_.file_id as file_id8_17_, fileversio1_.file_size as file_siz4_17_, fileversio1_.latest as latest5_17_, fileversio1_.uploader as uploader6_17_, fileversio1_.version_id as version_7_17_ from filesystem_file fileentity0_ left outer join lateral ( fileentity0_.deleted IS NULL) and ((select fileversio2_.comment, fileversio2_.created_at, fileversio2_.file_id, fileversio2_.file_size, fileversio2_.id, fileversio2_.latest, fileversio2_.uploader, fileversio2_.version_id from filesystem_file_version fileversio2_ where fileversio2_.file_id=fileentity0_.id order by fileversio2_.version_id DESC nulls last limit 1) is not null) fileversio1_(comment,created_at,file_id,file_size,id,latest,uploader,version_id) on (1=1) where ( fileentity0_.deleted IS NULL) and fileentity0_.id=?
Steps to reproduce
An @Entity
with Hibernate's @Where(clause="...")
and a relation @OneToMany(...)
for which an entity view with
@Mapping("...")
@Limit(limit="1", order={"..."})
Set<...> getLatest();
is used.
Environment
Version: 1.6.8
JPA-Provider: Hibernate 5.6.15.Final
DBMS: PostgreSQL 15.2
Application Server: Quarkus
Metadata
Metadata
Assignees
Labels
component: corekind: bugworth: highImplementing this has a high worthImplementing this has a high worth