本文整理汇总了Java中org.hibernate.sql.Delete.toStatementString方法的典型用法代码示例。如果您正苦于以下问题:Java Delete.toStatementString方法的具体用法?Java Delete.toStatementString怎么用?Java Delete.toStatementString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hibernate.sql.Delete
的用法示例。
在下文中一共展示了Delete.toStatementString方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateDeleteString
import org.hibernate.sql.Delete; //导入方法依赖的package包/类
/**
* Generate the SQL DELETE that deletes all rows
*/
@Override
protected String generateDeleteString() {
Delete delete = new Delete()
.setTableName( qualifiedTableName )
.addPrimaryKeyColumns( keyColumnNames );
if ( hasWhere ) delete.setWhere( sqlWhereString );
if ( getFactory().getSettings().isCommentsEnabled() ) {
delete.setComment( "delete collection " + getRole() );
}
return delete.toStatementString();
}
示例2: generateDeleteRowString
import org.hibernate.sql.Delete; //导入方法依赖的package包/类
/**
* Generate the SQL DELETE that deletes a particular row
*/
@Override
protected String generateDeleteRowString() {
Delete delete = new Delete()
.setTableName( qualifiedTableName );
if ( hasIdentifier ) {
delete.addPrimaryKeyColumns( new String[]{ identifierColumnName } );
}
else if ( hasIndex && !indexContainsFormula ) {
delete.addPrimaryKeyColumns( ArrayHelper.join( keyColumnNames, indexColumnNames ) );
}
else {
delete.addPrimaryKeyColumns( keyColumnNames );
delete.addPrimaryKeyColumns( elementColumnNames, elementColumnIsInPrimaryKey, elementColumnWriters );
}
if ( getFactory().getSettings().isCommentsEnabled() ) {
delete.setComment( "delete collection row " + getRole() );
}
return delete.toStatementString();
}
示例3: generateDeleteRowString
import org.hibernate.sql.Delete; //导入方法依赖的package包/类
/**
* Generate the SQL DELETE that deletes a particular row
*/
protected String generateDeleteRowString() {
Delete delete = new Delete()
.setTableName( qualifiedTableName );
if ( hasIdentifier ) {
delete.setPrimaryKeyColumnNames( new String[]{ identifierColumnName } );
}
else if ( hasIndex && !indexContainsFormula ) {
delete.setPrimaryKeyColumnNames( ArrayHelper.join( keyColumnNames, indexColumnNames ) );
}
else {
delete.setPrimaryKeyColumnNames( ArrayHelper.join( keyColumnNames, elementColumnNames, elementColumnIsInPrimaryKey ) );
}
if ( getFactory().getSettings().isCommentsEnabled() ) {
delete.setComment( "delete collection row " + getRole() );
}
return delete.toStatementString();
}
示例4: generateDeleteString
import org.hibernate.sql.Delete; //导入方法依赖的package包/类
/**
* Generate the SQL that deletes a row by id (and version)
*/
protected String generateDeleteString(int j) {
Delete delete = new Delete()
.setTableName( getTableName( j ) )
.addPrimaryKeyColumns( getKeyColumns( j ) );
if ( j == 0 ) {
delete.setVersionColumnName( getVersionColumnName() );
}
if ( getFactory().getSettings().isCommentsEnabled() ) {
delete.setComment( "delete " + getEntityName() );
}
return delete.toStatementString();
}
示例5: generateSQLDeletStrings
import org.hibernate.sql.Delete; //导入方法依赖的package包/类
private String[] generateSQLDeletStrings(Object[] loadedState) {
int span = getTableSpan();
String[] deleteStrings = new String[span];
for ( int j = span - 1; j >= 0; j-- ) {
Delete delete = new Delete()
.setTableName( getTableName( j ) )
.addPrimaryKeyColumns( getKeyColumns( j ) );
if ( getFactory().getSettings().isCommentsEnabled() ) {
delete.setComment( "delete " + getEntityName() + " [" + j + "]" );
}
boolean[] versionability = getPropertyVersionability();
Type[] types = getPropertyTypes();
for ( int i = 0; i < entityMetamodel.getPropertySpan(); i++ ) {
if ( isPropertyOfTable( i, j ) && versionability[i] ) {
// this property belongs to the table and it is not specifically
// excluded from optimistic locking by optimistic-lock="false"
String[] propertyColumnNames = getPropertyColumnNames( i );
boolean[] propertyNullness = types[i].toColumnNullness( loadedState[i], getFactory() );
for ( int k = 0; k < propertyNullness.length; k++ ) {
if ( propertyNullness[k] ) {
delete.addWhereFragment( propertyColumnNames[k] + " = ?" );
}
else {
delete.addWhereFragment( propertyColumnNames[k] + " is null" );
}
}
}
}
deleteStrings[j] = delete.toStatementString();
}
return deleteStrings;
}
示例6: generateDelete
import org.hibernate.sql.Delete; //导入方法依赖的package包/类
private String generateDelete(String tableName, String[] columnNames, String idSubselect, String comment) {
final Delete delete = new Delete()
.setTableName( tableName )
.setWhere( "(" + StringHelper.join( ", ", columnNames ) + ") IN (" + idSubselect + ")" );
if ( factory().getSettings().isCommentsEnabled() ) {
delete.setComment( comment );
}
return delete.toStatementString();
}
示例7: generateDeleteString
import org.hibernate.sql.Delete; //导入方法依赖的package包/类
/**
* Generate the SQL that deletes a row by id (and version)
*/
protected String generateDeleteString(int j) {
Delete delete = new Delete()
.setTableName( getTableName( j ) )
.setPrimaryKeyColumnNames( getKeyColumns( j ) );
if ( j == 0 ) {
delete.setVersionColumnName( getVersionColumnName() );
}
if ( getFactory().getSettings().isCommentsEnabled() ) {
delete.setComment( "delete " + getEntityName() );
}
return delete.toStatementString();
}
示例8: generateSQLDeletStrings
import org.hibernate.sql.Delete; //导入方法依赖的package包/类
private String[] generateSQLDeletStrings(Object[] loadedState) {
int span = getTableSpan();
String[] deleteStrings = new String[span];
for ( int j = span - 1; j >= 0; j-- ) {
Delete delete = new Delete()
.setTableName( getTableName( j ) )
.setPrimaryKeyColumnNames( getKeyColumns( j ) );
if ( getFactory().getSettings().isCommentsEnabled() ) {
delete.setComment( "delete " + getEntityName() + " [" + j + "]" );
}
boolean[] versionability = getPropertyVersionability();
Type[] types = getPropertyTypes();
for ( int i = 0; i < entityMetamodel.getPropertySpan(); i++ ) {
if ( isPropertyOfTable( i, j ) && versionability[i] ) {
// this property belongs to the table and it is not specifically
// excluded from optimistic locking by optimistic-lock="false"
String[] propertyColumnNames = getPropertyColumnNames( i );
boolean[] propertyNullness = types[i].toColumnNullness( loadedState[i], getFactory() );
for ( int k = 0; k < propertyNullness.length; k++ ) {
if ( propertyNullness[k] ) {
delete.addWhereFragment( propertyColumnNames[k] + " = ?" );
}
else {
delete.addWhereFragment( propertyColumnNames[k] + " is null" );
}
}
}
}
deleteStrings[j] = delete.toStatementString();
}
return deleteStrings;
}
示例9: generateDeleteString
import org.hibernate.sql.Delete; //导入方法依赖的package包/类
/**
* Generate the SQL DELETE that deletes all rows
*/
protected String generateDeleteString() {
Delete delete = new Delete()
.setTableName( qualifiedTableName )
.setPrimaryKeyColumnNames( keyColumnNames );
if ( hasWhere ) delete.setWhere( sqlWhereString );
if ( getFactory().getSettings().isCommentsEnabled() ) {
delete.setComment( "delete collection " + getRole() );
}
return delete.toStatementString();
}
示例10: MultiTableDeleteExecutor
import org.hibernate.sql.Delete; //导入方法依赖的package包/类
public MultiTableDeleteExecutor(HqlSqlWalker walker) {
super( walker, log );
if ( !walker.getSessionFactoryHelper().getFactory().getDialect().supportsTemporaryTables() ) {
throw new HibernateException( "cannot perform multi-table deletes using dialect not supporting temp tables" );
}
DeleteStatement deleteStatement = ( DeleteStatement ) walker.getAST();
FromElement fromElement = deleteStatement.getFromClause().getFromElement();
String bulkTargetAlias = fromElement.getTableAlias();
this.persister = fromElement.getQueryable();
this.idInsertSelect = generateIdInsertSelect( persister, bulkTargetAlias, deleteStatement.getWhereClause() );
log.trace( "Generated ID-INSERT-SELECT SQL (multi-table delete) : " + idInsertSelect );
String[] tableNames = persister.getConstraintOrderedTableNameClosure();
String[][] columnNames = persister.getContraintOrderedTableKeyColumnClosure();
String idSubselect = generateIdSubselect( persister );
deletes = new String[tableNames.length];
for ( int i = tableNames.length - 1; i >= 0; i-- ) {
// TODO : an optimization here would be to consider cascade deletes and not gen those delete statements;
// the difficulty is the ordering of the tables here vs the cascade attributes on the persisters ->
// the table info gotten here should really be self-contained (i.e., a class representation
// defining all the needed attributes), then we could then get an array of those
final Delete delete = new Delete()
.setTableName( tableNames[i] )
.setWhere( "(" + StringHelper.join( ", ", columnNames[i] ) + ") IN (" + idSubselect + ")" );
if ( getFactory().getSettings().isCommentsEnabled() ) {
delete.setComment( "bulk delete" );
}
deletes[i] = delete.toStatementString();
}
}
示例11: generateDelete
import org.hibernate.sql.Delete; //导入方法依赖的package包/类
private String generateDelete(String tableName, String[] columnNames,
String idSubselect, String comment) {
final Delete delete = new Delete().setTableName( tableName).setWhere(
"(" + StringHelper.join( ", ", columnNames) + ") IN ("
+ idSubselect + ")");
if (factory().getSettings().isCommentsEnabled()) {
delete.setComment(comment);
}
return delete.toStatementString();
}
开发者ID:epiresdasilva,项目名称:cte-multi-table-bulk-id-stategy,代码行数:11,代码来源:CTEBasedDeleteHandlerImpl.java
示例12: generateDelete
import org.hibernate.sql.Delete; //导入方法依赖的package包/类
private String generateDelete(String tableName, String[] columnNames,
String idSubselect, String comment) {
final Delete delete = new Delete().setTableName(tableName).setWhere(
"(" + StringHelper.join(", ", columnNames) + ") IN ("
+ idSubselect + ")");
if (factory().getSettings().isCommentsEnabled()) {
delete.setComment(comment);
}
return delete.toStatementString();
}
开发者ID:epiresdasilva,项目名称:cte-multi-table-bulk-id-stategy,代码行数:11,代码来源:CTEBasedDeleteHandlerImpl.java