org.hibernate.dialect
Class MySQLDialect

java.lang.Object
  extended byorg.hibernate.dialect.Dialect
      extended byorg.hibernate.dialect.MySQLDialect
Direct Known Subclasses:
MySQLInnoDBDialect, MySQLMyISAMDialect

public class MySQLDialect
extends Dialect

An SQL dialect for MySQL.

Author:
Gavin King

Field Summary
 
Fields inherited from class org.hibernate.dialect.Dialect
CLOSED_QUOTE, QUOTE
 
Constructor Summary
MySQLDialect()
           
 
Method Summary
 SQLExceptionConverter buildSQLExceptionConverter()
          Build an instance of the SQLExceptionConverter preferred by this dialect for converting SQLExceptions into Hibernate's JDBCException hierarchy.
 char closeQuote()
          The closing quote for a quoted identifier
 String getAddColumnString()
          The syntax used to add a column to a table (optional).
 String getAddForeignKeyConstraintString(String constraintName, String[] foreignKey, String referencedTable, String[] primaryKey)
          The syntax used to add a foreign key constraint to a table.
 String getColumnComment(String comment)
           
 String getDropForeignKeyString()
           
 String getIdentityColumnString()
           
 String getIdentitySelectString()
           
 String getLimitString(String sql, boolean hasOffset)
          Add a LIMIT clause to the given SQL SELECT
 char getSchemaSeparator()
          The separator between the schema/catalog/tablespace name and the table name.
 String getSelectGUIDString()
           
 String getTableComment(String comment)
           
 char openQuote()
          The opening quote for a quoted identifier
 boolean qualifyIndexName()
          Do we need to qualify index names with the schema name?
 boolean supportsCascadeDelete()
           
 boolean supportsIdentityColumns()
          Does this dialect support identity column key generation?
 boolean supportsIfExistsBeforeTableName()
           
 boolean supportsLimit()
          Does this Dialect have some kind of LIMIT syntax?
 
Methods inherited from class org.hibernate.dialect.Dialect
appendIdentitySelectToInsert, appendLockHint, bindLimitParametersFirst, bindLimitParametersInReverseOrder, createCaseFragment, createOuterJoinFragment, dropConstraints, forUpdateOfColumns, getAddPrimaryKeyConstraintString, getCascadeConstraintsString, getCreateSequenceString, getCreateSequenceStrings, getDefaultProperties, getDialect, getDialect, getDropSequenceString, getDropSequenceStrings, getForUpdateNowaitString, getForUpdateNowaitString, getForUpdateString, getForUpdateString, getFunctions, getIdentityColumnString, getIdentityInsertString, getIdentitySelectString, getLimitString, getLowercaseFunction, getNativeIdentifierGeneratorClass, getNoColumnsInsertString, getNullColumnString, getQuerySequencesString, getResultSet, getSelectClauseNullString, getSequenceNextValString, getTableTypeString, getTypeName, getTypeName, getViolatedConstraintNameExtracter, hasAlterTable, hasDataTypeInIdentityColumn, hasSelfReferentialForeignKeyBug, quote, registerColumnType, registerColumnType, registerFunction, registerResultSetOutParameter, supportsColumnCheck, supportsCommentOn, supportsIfExistsAfterTableName, supportsInsertSelectIdentity, supportsLimitOffset, supportsNotNullUnique, supportsOuterJoinForUpdate, supportsSequences, supportsTableCheck, supportsUnionAll, supportsUnique, supportsUniqueConstraintInCreateAlterTable, supportsVariableLimit, toString, useInputStreamToInsertBlob, 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

getAddColumnString

public String getAddColumnString()
Description copied from class: Dialect
The syntax used to add a column to a table (optional).

Overrides:
getAddColumnString in class Dialect

qualifyIndexName

public boolean qualifyIndexName()
Description copied from class: Dialect
Do we need to qualify index names with the schema name?

Overrides:
qualifyIndexName in class Dialect
Returns:
boolean

supportsIdentityColumns

public boolean supportsIdentityColumns()
Description copied from class: Dialect
Does this dialect support identity column key generation?

Overrides:
supportsIdentityColumns in class Dialect
Returns:
boolean

getIdentitySelectString

public String getIdentitySelectString()
Overrides:
getIdentitySelectString in class Dialect

getIdentityColumnString

public String getIdentityColumnString()
Overrides:
getIdentityColumnString in class Dialect

getAddForeignKeyConstraintString

public String getAddForeignKeyConstraintString(String constraintName,
                                               String[] foreignKey,
                                               String referencedTable,
                                               String[] primaryKey)
Description copied from class: Dialect
The syntax used to add a foreign key constraint to a table.

Overrides:
getAddForeignKeyConstraintString in class Dialect
Returns:
String

supportsLimit

public boolean supportsLimit()
Description copied from class: Dialect
Does this Dialect have some kind of LIMIT syntax?

Overrides:
supportsLimit in class Dialect

getDropForeignKeyString

public String getDropForeignKeyString()
Overrides:
getDropForeignKeyString in class Dialect

getLimitString

public String getLimitString(String sql,
                             boolean hasOffset)
Description copied from class: Dialect
Add a LIMIT clause to the given SQL SELECT

Overrides:
getLimitString in class Dialect
Returns:
the modified SQL

closeQuote

public char closeQuote()
Description copied from class: Dialect
The closing quote for a quoted identifier

Overrides:
closeQuote in class Dialect

openQuote

public char openQuote()
Description copied from class: Dialect
The opening quote for a quoted identifier

Overrides:
openQuote in class Dialect

supportsIfExistsBeforeTableName

public boolean supportsIfExistsBeforeTableName()
Overrides:
supportsIfExistsBeforeTableName in class Dialect

getSchemaSeparator

public char getSchemaSeparator()
Description copied from class: Dialect
The separator between the schema/catalog/tablespace name and the table name.

Overrides:
getSchemaSeparator in class Dialect

getSelectGUIDString

public String getSelectGUIDString()
Overrides:
getSelectGUIDString in class Dialect

supportsCascadeDelete

public boolean supportsCascadeDelete()
Overrides:
supportsCascadeDelete in class Dialect

getTableComment

public String getTableComment(String comment)
Overrides:
getTableComment in class Dialect

getColumnComment

public String getColumnComment(String comment)
Overrides:
getColumnComment in class Dialect

buildSQLExceptionConverter

public SQLExceptionConverter buildSQLExceptionConverter()
Build an instance of the SQLExceptionConverter preferred by this dialect for converting SQLExceptions into Hibernate's JDBCException hierarchy. The default Dialect implementation simply returns a converter based on X/Open SQLState codes.

It is strongly recommended that specific Dialect implementations override this method, since interpretation of a SQL error is much more accurate when based on the ErrorCode rather than the SQLState. Unfortunately, the ErrorCode is a vendor- specific approach.

Overrides:
buildSQLExceptionConverter in class Dialect
Returns:
The Dialect's preferred SQLExceptionConverter.