So, this is about a problem I solved by trial and error, but I need to understand what happened.
The symptom: in the Hibernate generted SQL, there was an error, which resulted in MySQL reporting the table not being found.
The background:
- used Hibernate Tools to reverse engineer a few sample tables from MySQL test db.
- had class mappings like '<class name="mypkg.Customer" table="customer" catalog="mycat">...
Hibernate version:
3.0.5
Name and version of the database you are using:
MySQL 4.1
The generated SQL (show_sql=true):
select xxx from mycat_customer customer0_ where ...
After going through some of the postings here, somehow it occured to me that since this catalog value is optional in the class mapping, I thought I should see what I get without it. Well, it worked.
So, my question(s) would be:
1) What is the principle that makes Hibernate prepend the table name with the catalog value?
2) Is the Hibernate tool that made the mappings was wrong in creating this catalog value?
Thanks for anybody's comments in advance.
Karoly
|