Example usage for org.hibernate.dialect Dialect getCascadeConstraintsString

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

Introduction

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

Prototype

public String getCascadeConstraintsString() 

Source Link

Document

Completely optional cascading drop clause

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  . ja  v  a2 s. com
    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 ww.  j av 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./*  w w w  .  ja va2  s.  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   ww  w .  ja  v a2 s . c  o m*/
 * @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() };
}