Hi,
I'm using Hibernate for my SpringMVC web application with MySQL. I've used Hibernate Tools to auto-generate the Mapping POJO classes from my database.
Everything works fine except for one thing. Whenever there's any HQL executed that is supposed to fetch data from link tables via joins, the HQL is ill-formed.
E.g. I'm using LAZY fetching to get some related data. So the HQL that is auto-generated repeats the Schema name twice...e.g.
Code:
SELECT citynames2_.CityID AS CityID5_, citynames2_.CityName AS CityName5_
FROM mad.mad.state_names statenames0_ INNER JOIN mad.state_city citynamese1_ on statenames0_.StateID=citynamese1_.StateID inner join mad.city_names citynames2_ on citynamese1_.CityID=citynames2_.CityID where stateName=?
Please note the repeating schema above. (My schema name is mad, which is also the default schema)
And hence i get the exception:
Code:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.state_city citynamese1_ on statenames0_.StateID=citynamese1_.StateID inner join' at line 1
Please guide me. How to solve this problem.