org.hibernate.procedure.ProcedureOutputsImpl tries to map all returned resultsets to the column set of the first resultset
Description
Activity

Sanne Grinovero September 8, 2021 at 5:49 PM
sounds great, good luck!
I’d suggest though to upgrade to ORM v5 first, only then switch to 6 - should be easier in smaller steps.

Maurice September 8, 2021 at 5:12 PM
@SanneGrinovero
My app is currently still running on version 4 but i will upgrade it in the near future to version 6. Then i will also test if the behaviour is still present in version 6 and contribute a test if it is. I’ll also try to fix the problem myself then. For now I’ll add this issue as an issue in my YouTrack app so that i won’t forget.

Sanne Grinovero September 8, 2021 at 9:01 AM
yes this is an open source project, anyone can contribute code patches and improvements; in fact this project wouldn’t have been possible without thousands of people helping out at least a little. In practice some of us (like Steve) work full time on it but we need to prioritize our work according to the needs of the bigger picture and make sure the project evolves in a sensible way.
Unfortunately this implies we can’t address all requests; in particular in t his case you have a fair point that the implementation is not ideal, but it’s serving well enough and isn’t technically qualified as a bug - also you’re reporting it on version 4 which we no longer maintain at all.
The best way forward for you is to either:
patch the code yourself - you can find it all on , instructions for development included. If you then send a PR and are open to feedback (it usually will require multiple iterations, especially if you’re new to it) we’re then likely to integrate it in a future version and you’ll have helped all other people needing a similar feature - but let’s be clear we’re not going to work on another maintenance release of version 4.
At least contribute a test, that will make it more likely from someone else to volunteer and improve things. That’s also very helpful.
Wait and cross fingers that Hibernate 6 or another future version will handle this better.
Whatever you choose is up to you, but there’s a common requirement among these suggestions: you need to upgrade from using this old an unmaintained version, otherwise you’re totaly on your own.
Also, could you please test this behaviour on our latest releases and update the “Affects versions” field - if it’s only some version 4.3 then we’ll close it as out of date.
Thanks!

Maurice September 7, 2021 at 11:19 PM
@Steve Ebersole What do you mean with ‘If you implement the solution that would get it resolved much sooner’. Am i allowed to make adjustments to the code of hibernate myself?

Maurice September 7, 2021 at 11:17 PMEdited
i didn’t mean to offend you @SteveEbersole, your name was the only one that popped up in the suggestion list.
I have a stored procedure that returns different resultsets each consisting of different columns. I use an implementation object of ProcedureOutputs to retrieve each resultset consequtively using the method callOutputs.getCurrent() and callOutputs.goToNext() in a while loop. This first one is always retrieved without issues. The second one however will throw a `Column 'xyz' does not exist` error when the first resultset happens to contain a column xyz that it does not share with the second resultset retrieved. Only when the second and any other resultset after that have the exact same column set, with all columns arranged in the same order, no problems arise. But often this is not the case.
The bug is thus that hibernate tries to map any consecutive resultset to the same column set that existed in the first resultset. I don't know why it tries to do this. It reminds me of another functionality where Hibernate casts one resultset to a predefined entity. But it shouldn't do that here, because it is simply not instructed to do so.
Here are two threads on stackoverflow and dba that also report this problem.
https://stackoverflow.com/questions/24641818/using-jpa-with-stored-procedures-that-return-multiple-result-sets
https://dba.stackexchange.com/questions/265890/can-a-mysql-stored-procedure-return-multiple-resultsets-each-containing-differen?noredirect=1#comment523515_265890