-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filtering data sometimes throws ORM exception (Hibernate 6.1) #150
Comments
Good morning. I can only say that it is happen when it's only one character on the search input, very rare error. Just for the record, I'm working on Angular 15 with angular-datatables setting "server-side" options: https://l-lin.github.io/angular-datatables/#/basic/new-server-side - No character at input "search" (No error on Spring Boot): - Only one character at input "search" (Error on Spring Boot): java.lang.IllegalArgumentException: Already registered a copy: SqmBasicValuedSimplePath(com.basewarnet.ungrd.models.tipos.ClaseContrato(268069621620900).codigoClaseContrato) { org.springframework.transaction.UnexpectedRollbackException: Transaction silently rolled back because it has been marked as rollback-only - More than one character at input "search" (No error on Spring Boot): |
In our case, there are "good" characters, e.g. 'c', 'm', '1' works fine. Putting 'e' into the search input causes this error, but 'el' and 'en' are fine again. |
Hi! I'm digging into this, I will try to reproduce the issue locally. Possibly related: https://stackoverflow.com/questions/74262361/error-when-trying-to-filter-data-in-spring-boot/75172780#75172780 |
We found some Hibernate issues that might be related to this problem: |
Hmm, so the error is thrown at line 85: Line 85 in cfb25fc
Are you using a Else, it seems https://hibernate.atlassian.net/browse/HHH-16014 was fixed in |
We don't use preFilteringSpecification. For the first problematic table, we use the simple DataTablesRepository.findAll(DataTablesInput input) method. In case of the other table, there is an additionalSpecification parameter. We have tried all Hibernate versions above 6.0.0. (e.g. 6.1.6, 6.1.7 and 6.2.0.CR2). Unfortunately none of them helped us.
Exception in case of 6.2.0.CR2 version is also a little bit different:
|
Good morning from Bogotá, Colombia! No. I'm just using repository.findAll(DataTablesInput input), no filters, no specification. Nothing else. This is what service class receives from the Angular datatable when I enter the "e" character: The service class has these anotations: By the way, in my case, the locale language is es-CO and the Default Encoding is "ISO-8859-1". Thanks a lot!!!! |
The library creates the following queries: - 1 count query (unfiltered, to compute the "recordsTotal" field) - 1 data query (filtered) - 1 optional count query (filtered), if the data query returns a complete slice, in order to compute the "recordsFiltered" field Before this commit, when the optional count query ran, DataTablesSpecification.toPredicate() was called a second time and reused the globalPredicates array, triggering one of the following error: > java.lang.IllegalArgumentException: Already registered a copy > jakarta.persistence.PersistenceException: Converting org.hibernate.sql.ast.SqlTreeCreationException to JPA PersistenceException : Could not locate TableGroup Related: #150
Awesome! Thank you for your work, in our case it's working now without any problems! |
I've updated the sample project with Spring Boot 3, all seem to work well now: https://github.com/darrachequesne/spring-data-jpa-datatables-sample Please reopen if needed. |
We have migrated our application to Spring Boot 3.0.2 using Hibernate 6.1 and Datatables 6.0.0. After the migration, the filtering function of some tables no longer works. We get different ORM related exceptions like "Already registered a copy: SqmBasicValuedSimplePath" or "Already registered a copy: SqmSingularJoin" (stack trace below)
The text was updated successfully, but these errors were encountered: