Closed mdadil-dk closed 3 months ago
Care to attach the full stack trace? The one is truncated and doesn't show the actual cause.
@mp911de Have updated the full stack trace in issue
Alright. Thanks a lot. With
Caused by: org.hibernate.sql.ast.SqlTreeCreationException: Could not locate TableGroup - com.example.ganymede.report.data.models.ReportsEntity(396507765603252)
at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.prepareReusablePath(BaseSqmToSqlAstConverter.java:3615)
you can post the full stack trace at the Hibernate forums as the underlying cause is a Hibernate exception. The top-most exception, org.springframework.orm.jpa.JpaSystemException
is part of Spring's exception translation mechanism so that libraries using JPA do not need to handle vendor-specific exceptions.
Let me know how the Forum discussion goes. I will leave this ticket open until we get further guidance from the Hibernate team.
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.
Hey ! I don't know if I should bump this previous issue or create a new one but...
OP did post his issue in Hibernate forums and issue is kinda stuck there too.
It seems i'm having myself trouble with this same issue.
Debugging between Spring-JPA & Hibernate-SQM isn't really my thing but it seems the issue comes from the underlying countQuery from SimpleJpaRepository when using a Pageable.
Debugging in BaseSqmToSqlAstConverter.prepareReusablePath
(from Hibernate-core) shows me the first set of requests, coming from SimpleJpaRepository.findAll(Specification, Pageable)
seems to work fine.
But the second request coming from SimpleJpaRepository.executeCountQuery
crashes with the same error from OP.
When it comes in prepareReusablePath
from here, ids of NavigablePath
don't match anymore (like if JPA Root weren't the same anymore or something like that).
I use Spring Boot 3.3.1
with provided
Spring Data JPA 3.3.1
Hibernate-Core 6.5.2.Final
@mfrechePgest if you have something like a minimal sample (something that we can unzip or git clone, build, and deploy) that reproduces the problem please feel free to reopen this issue since it was auto closed due to lack of feedback. Thank you!
@christophstrobl Thanks ! Here is a sample repo with the issue. https://github.com/mfrechePgest/spring-data-3224
Just run Junit test, it should crash
Writing it showed me the crash occurs when there's more results than the requested page size. In our production environment, the bug sounded kinda "random"... but it wasn't related to some data after all.
@christophstrobl Sry for spam but you told me to
feel free to reopen this issue
Don't think I can do this myself ? How ?
Update :
I found a fix in the simple repo Issue seems to come from the fact that filters are kept in specification attributes.
In my real production repository, Specification is obviously more complicated but we can refactor it so we don't have any instance attributes.
Can't say if there's an underlying bug anyway, but at least i've got a workaround.
EDIT : And OP had the same thing too : his List<Predicate>
was outside of his lambda.
Environment:
We are working with Spring Data specification for creating dynamic queries and have Pagination. Getting the following error in some cases where we change the values of Pageable size and page.
Specification:
Pageable:
The current change is working as expected in a few cases but failing in other cases.
Working case: Suppose the total rows in the reports table are 15 and if we make the Pageable request. Here, the page.number * page.size is around the total number of rows in the database table.
Failed case:
The above specification is a basic filter, it will be dynamic and should able to handle mutiples columns to query across multiple Join tables. is the above behavior of Specification and pageable expected? Did we miss some configuration or any other changes?
Full stack trace:
StackOverflow Hibernate Forum
Edited- Full stack trace