[hibernate-issues] [Hibernate-JIRA] Commented: (HB-1570) CLONE -dropIndex doesn't cound on Dialect
Ohad Bruker (JIRA)
noreply at atlassian.com
Thu Oct 26 03:24:05 EDT 2006
[ http://opensource.atlassian.com/projects/hibernate/browse/HB-1570?page=comments#action_24991 ]
Ohad Bruker commented on HB-1570:
---------------------------------
Due to the same reason above the generated SQL for drop index is not correct for Oracle 9i.
drop index {tablename}.{indexname} format is illegal in several databases and should use the dialect for this statement creation.
Suggested solution:
1) Add to org.hibernate.dialect.Dialect:
public boolean qualifyIndexNameWithTable() {
return true;
}
2) For Oracle9i dialect (and for MySql DB as mentioned above) qualifyIndexNameWithTable returns false.
3) Update org.hibernate.mapping.Index:
public String sqlDropString(Dialect dialect, String defaultCatalog, String defaultSchema) {
return "drop index " + dialect.qualifyIndexNameWithTable()
? StringHelper.qualify(table.getQualifiedName(dialect, defaultCatalog, defaultSchema), name);
: name;
}
> CLONE -dropIndex doesn't cound on Dialect
> -----------------------------------------
>
> Key: HB-1570
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HB-1570
> Project: Hibernate2
> Type: Bug
> Components: core
> Versions: 2.1.6
> Environment: Hibernate 2.1.6, MySql 4.??
> Reporter: Ohad Bruker
>
>
> In class net.sf.hibernate.mapping.Index method
> sqlDropString(Dialect dialect)
> doesn't count on dialect, and always makes name of index qualified:
> return "drop index " + StringHelper.qualify( table.getQualifiedName(dialect), name);
> This will fail at least in case of MySql DB, because it doesn't understand {tablename}.{indexname} constructions, but {indexname} only.
> I propose next edition:
> return "drop index " + (dialect.qualifyIndexName() ? StringHelper.qualify( table.getQualifiedName(dialect), name) : name);
> Is it suitable?
--
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
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list