Example usage for org.hibernate.dialect Dialect supportsIfExistsBeforeTableName

List of usage examples for org.hibernate.dialect Dialect supportsIfExistsBeforeTableName

Introduction

In this page you can find the example usage for org.hibernate.dialect Dialect supportsIfExistsBeforeTableName.

Prototype

public boolean supportsIfExistsBeforeTableName() 

Source Link

Document

For dropping a table, can the phrase "if exists" be applied before the table name?

Usage

From source file:de.innovationgate.webgate.api.mysql.GaleraClusterTableGenerator.java

License:Open Source License

@Override
public String[] sqlDropStrings(Dialect dialect) throws HibernateException {
    StringBuilder sqlDropString = new StringBuilder().append("drop table ");
    if (dialect.supportsIfExistsBeforeTableName()) {
        sqlDropString.append("if exists ");
    }/*  w w  w .  j  a  v a2 s  .  co  m*/
    sqlDropString.append(tableName).append(dialect.getCascadeConstraintsString());
    if (dialect.supportsIfExistsAfterTableName()) {
        sqlDropString.append(" if exists");
    }
    return new String[] { sqlDropString.toString() };
}

From source file:org.hyperic.hibernate.id.HQMultipleHiLoPerTableGenerator.java

License:Open Source License

public String[] sqlDropStrings(Dialect dialect) throws HibernateException {
    StringBuffer sqlDropString = new StringBuffer().append("drop table ");
    if (dialect.supportsIfExistsBeforeTableName())
        sqlDropString.append("if exists ");
    sqlDropString.append(tableName).append(dialect.getCascadeConstraintsString());
    if (dialect.supportsIfExistsAfterTableName())
        sqlDropString.append(" if exists");
    return new String[] { sqlDropString.toString() };
}

From source file:org.jboss.ejb3.entity.JTATableIdGenerator.java

License:Open Source License

public String[] sqlDropStrings(Dialect dialect) {
    //return "drop table " + tableName + dialect.getCascadeConstraintsString();
    StringBuffer sqlDropString = new StringBuffer().append("drop table ");
    if (dialect.supportsIfExistsBeforeTableName()) {
        sqlDropString.append("if exists ");
    }/*from  w  w w. j  a  v  a 2 s  . c om*/
    sqlDropString.append(tableName).append(dialect.getCascadeConstraintsString());
    if (dialect.supportsIfExistsAfterTableName()) {
        sqlDropString.append(" if exists");
    }
    return new String[] { sqlDropString.toString() };
}

From source file:org.nuxeo.ecm.directory.sql.repository.Table.java

License:Open Source License

/**
 * Computes the SQL statement to drop the table.
 *
 * @param dialect the dialect./*from   ww  w .j  ava 2s  . c  o m*/
 * @return the SQL drop string.
 */
public String getDropSql(Dialect dialect) {
    StringBuilder buf = new StringBuilder();
    buf.append("drop table ");
    if (dialect.supportsIfExistsBeforeTableName()) {
        buf.append("if exists ");
    }
    buf.append(dialect.openQuote());
    buf.append(name);
    buf.append(dialect.closeQuote());
    buf.append(dialect.getCascadeConstraintsString());
    if (dialect.supportsIfExistsAfterTableName()) {
        buf.append(" if exists");
    }
    return buf.toString();
}

From source file:org.opentaps.foundation.entity.hibernate.OpentapsIdentifierGenerator.java

License:Open Source License

/**
 * The SQL required to remove the underlying database objects.
 *
 * @param dialect The dialect against which to generate the drop sql
 * @return The drop command(s)//from  w w w  . ja v  a  2 s.  c om
 * @throws HibernateException problem creating the drop sql
 */
public String[] sqlDropStrings(Dialect dialect) throws HibernateException {
    // build drop table ddl sql with specific dialect
    StringBuffer sqlDropString = new StringBuffer().append("drop table ");
    if (dialect.supportsIfExistsBeforeTableName()) {
        sqlDropString.append("if exists ");
    }
    sqlDropString.append(SEQUENCE_TABLE_NAME).append(dialect.getCascadeConstraintsString());
    if (dialect.supportsIfExistsAfterTableName()) {
        sqlDropString.append(" if exists");
    }
    return new String[] { sqlDropString.toString() };
}