From: <leg...@at...> - 2003-10-19 04:11:24
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-409 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-409 Summary: SchemaUpdate fails on MySQL 4.0.11 because table name case sensitivity Type: Bug Status: Unassigned Priority: Major Project: Hibernate2 Components: toolset Versions: 2.0.3 Assignee: Reporter: Toni Bennasar Obrador Created: Sat, 18 Oct 2003 5:44 PM Updated: Sat, 18 Oct 2003 5:44 PM Environment: Mandrake Linux 9.1 on x86, using MySQL 4.0.11 and official MySQL JDBC v3.0.9 , and Hibernate 2.0.3 Description: Hello. I have the following problems: I try to do a SchemaUpdate over a MySQL DB over database where the update should add some fields to some table, but the SchemaUpdate try to re-create the table, with <<SQLException>> results... I did a debug to see what happens and the problem is at net.sf.hibernate.tool.hbm2ddl.DatabaseMetadata at line 47 , where the tool finds if the table exists or not, to create or update the table, : public TableMetadata getTableMetadata(String name) throws HibernateException { ... String[] types = {"TABLE"}; ResultSet rs = null; try { try { THIS>>rs = meta.getTables(null, "%", name.toUpperCase(), types); while ( rs.next() ) { if ( name.equalsIgnoreCase( rs.getString("TABLE_NAME") ) ) { table = new TableMetadata(rs, meta); tables.put( name.toUpperCase(), table ); break; } The line 47 is rs=meta.getTables(null, "%", name.toUpperCase(),Types); The problem is that hibernate creates the tables (with SchemaExport) with lower case, and MySQL is case sensitive for table names on Unix (see http://www.mysql.com/doc/en/Name_case_sensitivity.html). But the .getTables call finds the upper case table name. Then, never is found, and it try to create the table when it exists. The fix is remove the .toUpperCase() : rs = meta.getTables(null, "%", name, types); or SchemaExport should create the tables with upper case. Hibernate is great. Thanks for all. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |