Is there a limit to the number of joins permitted in a JPA/Hibernate query?
Since Hibernate doesn\'t automatically join, I have to explicitly specify the joins in my
I've once hit the MySQL 5.0 61 table limit with Hibernate:
ERROR 1116 (HY000): Too many tables; MySQL can only use 61 tables in a join
Are you aliasing all of your inner joins? And using those aliases? I have seen some really strange behavior with Hibernate when you try and use implicit aliasing in the SELECT
clause to do stuff like this (extremely simplified example):
select p.address.state from person p
But if you explicitly declare all your aliases it works just fine. Like this:
select s from person p join p.address a join a.state s
... or even this:
select s from person p join p.address.state s
The question is why are you trying to make such a complex query in the first place?
Have you considered different approaches? The documentation on improving performance makes some suggestions.
There is nothing within the Hibernate code which limits the number of joins. This could be a bug in the dialect, or a limitation of the database engine. But my money's on a bug unrelated to the number of joins! Have you tried running the SQL directly in an interactive query session?
Have you tried to execute with the actual jdbc driver in use? It might be a issue of the jdbc driver.
Although judging from the name of the column, it is looking for, I'd guess there is some trimming/construction of names going wrong. Definitely looks more like a bug than a intended limit.