Hello users,
I encountered the following problem with the catalog attribute in a hibernate mapping.
Consider the following example: You have configure hibernate to use 2 databases ("db1" and "db2") where "db1" is the default one. And you have defined a mapping for a class "A" that is mapped to a table "tab_a" in database "db2" via the catalog attribute. Then everything works fine as long as you use simple HQL queries like "select a from A a". Hibernate uses "db2.tab_a" as table identification. But when you try to retrieve the number of persistent instances of A via "select count(a) from A a" hibernate forget to add the database name in front of the table name. Thus you get an SQL error that table "tab_a" does not exist in database "db1".
I think this is a bug in hibernate. What do you think?
Regards, xylo
hibernate version: 3.3.2.GA
|