Hi all,
I am trying to migrate a springboot project from version 2.7 to version 3.1 and consequently from hibernate version 5.6.15 to version 6.2.17 but I am having problems with a specific query in which as the title mentions a temporary table can’t be created.
This query is targeting a DB2 version 10.5 and the error thrown is the following:
Caused by: com.ibm.db2.jcc.am.SqlException: A temporary table could not be created because there is no available system temporary table space that has a compatible page size… SQLCODE=-1585, SQLSTATE=54048, DRIVER=4.19.77
The final query looks like this:
FROM Profile$Active p LEFT JOIN FETCH p.displayNameAttribute dna WHERE p.client.id = :clientId order by LOWER(COALESCE(dna.value, p.name)) asc
The culprit is that final statement with using dna.value
. If I remove it or swap for a different column it works. This is a column of the joined table which has a length of 10240 bytes which is way bigger than the others. Still, my db admin tells me that we have temporary table space of 16kb which should be enough to handle this.
Another important consideration is that the exact same query was working in the previous version of hibernate with the same exact database which leads me to think that this is some misconfiguration in hibernate.
When searching for answers regarding this problem the only thing that seemed that could be related was query.mutation_strategy
. Although, to my knowledge, I am not doing a mutation query I gave it a try as described here to use the inline strategy. It produced no effect, I got the same erros with all possible combinations.
One other thing that I wanted to try was to use the CteMutationStrategy
as described the migration guide since it, supposedly, does not use temporary tables. Unfortunately I couldn’t even start the application since the class does not have a constructor that is compatible with what spring is trying to instantiate, which is, apparently, passing a Dialect
.
As you might have noticed I am far from being an hibernate expert and I’ve spent several days around this problem with no success. I am, currently, out of ideas on how to proceed and any help would be really appreciated.
Let me know if any relevant information is missing from my description and I will add it rightway.
Thank you