com.atlassian.hibernate.dialect
Class MySQLDialect

java.lang.Object
  extended by net.sf.hibernate.dialect.Dialect
      extended by net.sf.hibernate.dialect.MySQLDialect
          extended by com.atlassian.hibernate.dialect.MySQLDialect

public class MySQLDialect
extends net.sf.hibernate.dialect.MySQLDialect

Custom MySQLDialect that specifies the constraint name when calling "add index". This fixes the problem of multiple indexes and FK contraints being created for tables when they already exist (CONF-1204)


Field Summary
 
Fields inherited from class net.sf.hibernate.dialect.Dialect
CLOSED_QUOTE, QUOTE
 
Constructor Summary
MySQLDialect()
           
 
Method Summary
 java.lang.String getAddForeignKeyConstraintString(java.lang.String constraintName, java.lang.String[] foreignKey, java.lang.String referencedTable, java.lang.String[] primaryKey)
          note: previously, this string also included an 'add index' component (which meant that for MySQL users get an index added for each of their FK's).
 
Methods inherited from class net.sf.hibernate.dialect.MySQLDialect
buildSQLExceptionConverter, closeQuote, dropConstraints, getAddColumnString, getDropForeignKeyString, getIdentityColumnString, getIdentitySelectString, getLimitString, getSchemaSeparator, openQuote, qualifyIndexName, supportsIdentityColumns, supportsIfExistsBeforeTableName, supportsLimit
 
Methods inherited from class net.sf.hibernate.dialect.Dialect
appendIdentitySelectToInsert, bindLimitParametersFirst, bindLimitParametersInReverseOrder, createCaseFragment, createOuterJoinFragment, getAddPrimaryKeyConstraintString, getCascadeConstraintsString, getCreateSequenceString, getDefaultProperties, getDialect, getDialect, getDropSequenceString, getFunctions, getIdentityInsertString, getLimitString, getLowercaseFunction, getNoColumnsInsertString, getNullColumnString, getQuerySequencesString, getSequenceNextValString, getTypeName, getTypeName, getViolatedConstraintNameExtracter, hasAlterTable, hasDataTypeInIdentityColumn, registerColumnType, registerColumnType, registerFunction, supportsCheck, supportsForUpdate, supportsForUpdateNowait, supportsForUpdateOf, supportsIfExistsAfterTableName, supportsLimitOffset, supportsSequences, supportsUnique, supportsUniqueConstraintInCreateAlterTable, supportsVariableLimit, toString, useMaxForLimit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MySQLDialect

public MySQLDialect()
Method Detail

getAddForeignKeyConstraintString

public java.lang.String getAddForeignKeyConstraintString(java.lang.String constraintName,
                                                         java.lang.String[] foreignKey,
                                                         java.lang.String referencedTable,
                                                         java.lang.String[] primaryKey)
note: previously, this string also included an 'add index' component (which meant that for MySQL users get an index added for each of their FK's). However, since we now specify the indexes explicitly in the hibernate mapping files, we need to comment this count to prevent duplicate indexes.

Overrides:
getAddForeignKeyConstraintString in class net.sf.hibernate.dialect.MySQLDialect


Copyright © 2003-2014 Atlassian. All Rights Reserved.