Hi,
I have a MySql server running multiples databases. I use the following connection URL to connect to my databases :
Code:
jdbc:mysql://127.0.0.1/
Hibernate seemed to perfectly work until I tried to add a row in one of my tables. I looked at the SQL query generated by Hibernate and it's missing the catalog prefix :
Code:
>16:29:46 [INFO] Hibernate: select max(id) from prohibited_item_log_entry
>16:29:46 [WARN] SQL Error: 1046, SQLState: 3D000
16:29:46 [ERROR] No database selected
Hibernate is trying to get the future id of the row but it doesn't tell in which database is located "prohibited_item_log_entry", this raises a SQL error. The generated query should be :
Code:
select max(id) from ftm_prohibition.prohibited_item_log_entry
"ftm_prohibition" is the database where "prohibited_item_log_entry" is located.
For all other queries, Hibernate use the "from [catalog].[table_name]" syntax, and everything works like a charm :
Code:
>16:29:41 [INFO] Hibernate: select prohibited0_.id as id1_6_, prohibited0_.version as version2_6_, prohibited0_.filter as filter6_6_ from ftm_prohibition.prohibited_item prohibited0_
How can I fix this problem ?