public Update addColumns(String[] columnNames, boolean[] updateable, String[] valueExpressions) { for ( int i=0; i<columnNames.length; i++ ) { if ( updateable[i] ) { addColumn( columnNames[i], valueExpressions[i] ); } } return this; }
/** * Generate the SQL UPDATE that updates a foreign key to a value */ @Override protected String generateInsertRowString() { final Update update = new Update( getDialect() ) .setTableName( qualifiedTableName ) .addColumns( keyColumnNames ); if ( hasIndex && !indexContainsFormula ) { for ( int i = 0 ; i < indexColumnNames.length ; i++ ) { if ( indexColumnIsSettable[i] ) { update.addColumn( indexColumnNames[i] ); } } } //identifier collections not supported for 1-to-many if ( getFactory().getSessionFactoryOptions().isCommentsEnabled() ) { update.setComment( "create one-to-many row " + getRole() ); } return update.addPrimaryKeyColumns( elementColumnNames, elementColumnWriters ) .toStatementString(); }
public Update addColumns(String[] columnNames, String valueExpression) { for ( String columnName : columnNames ) { addColumn( columnName, valueExpression ); } return this; }
/** * Generate the SQL UPDATE that updates all the foreign keys to null */ @Override protected String generateDeleteString() { final Update update = new Update( getDialect() ) .setTableName( qualifiedTableName ) .addColumns( keyColumnNames, "null" ) .addPrimaryKeyColumns( keyColumnNames ); if ( hasIndex && !indexContainsFormula ) { for ( int i = 0 ; i < indexColumnNames.length ; i++ ) { if ( indexColumnIsSettable[i] ) { update.addColumn( indexColumnNames[i], "null" ); } } } if ( hasWhere ) { update.setWhere( sqlWhereString ); } if ( getFactory().getSessionFactoryOptions().isCommentsEnabled() ) { update.setComment( "delete one-to-many " + getRole() ); } return update.toStatementString(); }
public Update addColumns(String[] columnNames) { for ( String columnName : columnNames ) { addColumn( columnName ); } return this; }
/** * Generate the SQL UPDATE that updates a particular row's foreign * key to null */ @Override protected String generateDeleteRowString() { final Update update = new Update( getDialect() ) .setTableName( qualifiedTableName ) .addColumns( keyColumnNames, "null" ); if ( hasIndex && !indexContainsFormula ) { for ( int i = 0 ; i < indexColumnNames.length ; i++ ) { if ( indexColumnIsSettable[i] ) { update.addColumn( indexColumnNames[i], "null" ); } } } if ( getFactory().getSessionFactoryOptions().isCommentsEnabled() ) { update.setComment( "delete one-to-many row " + getRole() ); } //use a combination of foreign key columns and pk columns, since //the ordering of removal and addition is not guaranteed when //a child moves from one parent to another String[] rowSelectColumnNames = ArrayHelper.join( keyColumnNames, elementColumnNames ); return update.addPrimaryKeyColumns( rowSelectColumnNames ) .toStatementString(); }
public Update addColumn(String columnName) { return addColumn(columnName, "?"); }
public Update addColumn(String columnName, Object value, LiteralType type) throws Exception { return addColumn( columnName, type.objectToSQLString(value, dialect) ); }
/** * Generate the SQL UPDATE that inserts a collection index */ @Override protected String generateUpdateRowString() { final Update update = new Update( getDialect() ).setTableName( qualifiedTableName ); update.addPrimaryKeyColumns( elementColumnNames, elementColumnIsSettable, elementColumnWriters ); if ( hasIdentifier ) { update.addPrimaryKeyColumns( new String[] {identifierColumnName} ); } if ( hasIndex && !indexContainsFormula ) { for ( int i = 0 ; i < indexColumnNames.length ; i++ ) { if ( indexColumnIsSettable[i] ) { update.addColumn( indexColumnNames[i] ); } } } return update.toStatementString(); }
private String generateVersionIncrementUpdateString() { Update update = new Update( getFactory().getDialect() ); update.setTableName( getTableName( 0 ) ); if ( getFactory().getSessionFactoryOptions().isCommentsEnabled() ) { update.setComment( "forced version increment" ); } update.addColumn( getVersionColumnName() ); update.addPrimaryKeyColumns( rootTableKeyColumnNames ); update.setVersionColumnName( getVersionColumnName() ); return update.toStatementString(); }
protected String generateLockString() { final SessionFactoryImplementor factory = lockable.getFactory(); final Update update = new Update( factory.getDialect() ); update.setTableName( lockable.getRootTableName() ); update.addPrimaryKeyColumns( lockable.getRootTableIdentifierColumnNames() ); update.setVersionColumnName( lockable.getVersionColumnName() ); update.addColumn( lockable.getVersionColumnName() ); if ( factory.getSessionFactoryOptions().isCommentsEnabled() ) { update.setComment( lockMode + " lock " + lockable.getEntityName() ); } return update.toStatementString(); }
protected String generateLockString() { final SessionFactoryImplementor factory = lockable.getFactory(); final Update update = new Update( factory.getDialect() ); update.setTableName( lockable.getRootTableName() ); update.addPrimaryKeyColumns( lockable.getRootTableIdentifierColumnNames() ); update.setVersionColumnName( lockable.getVersionColumnName() ); update.addColumn( lockable.getVersionColumnName() ); if ( factory.getSessionFactoryOptions().isCommentsEnabled() ) { update.setComment( lockMode + " lock " + lockable.getEntityName() ); } return update.toStatementString(); }
protected String generateLockString() { final SessionFactoryImplementor factory = lockable.getFactory(); final Update update = new Update( factory.getDialect() ); update.setTableName( lockable.getRootTableName() ); update.addPrimaryKeyColumns( lockable.getRootTableIdentifierColumnNames() ); update.setVersionColumnName( lockable.getVersionColumnName() ); update.addColumn( lockable.getVersionColumnName() ); if ( factory.getSessionFactoryOptions().isCommentsEnabled() ) { update.setComment( lockMode + " lock " + lockable.getEntityName() ); } return update.toStatementString(); }
public Update addColumns(String[] columnNames) { for ( int i=0; i<columnNames.length; i++ ) { addColumn( columnNames[i] ); } return this; }
public Update addColumns(String[] columnNames, String valueExpression) { for ( int i=0; i<columnNames.length; i++ ) { addColumn( columnNames[i], valueExpression ); } return this; }
public Update addColumns(String[] columnNames, String valueExpression) { for ( int i=0; i<columnNames.length; i++ ) { addColumn( columnNames[i], valueExpression ); } return this; }
protected String generateLockString() { final SessionFactoryImplementor factory = lockable.getFactory(); final Update update = new Update( factory.getDialect() ); update.setTableName( lockable.getRootTableName() ); update.addPrimaryKeyColumns( lockable.getRootTableIdentifierColumnNames() ); update.setVersionColumnName( lockable.getVersionColumnName() ); update.addColumn( lockable.getVersionColumnName() ); if ( factory.getSessionFactoryOptions().isCommentsEnabled() ) { update.setComment( lockMode + " lock " + lockable.getEntityName() ); } return update.toStatementString(); }
protected String generateLockString() { final SessionFactoryImplementor factory = lockable.getFactory(); final Update update = new Update( factory.getDialect() ); update.setTableName( lockable.getRootTableName() ); update.addPrimaryKeyColumns( lockable.getRootTableIdentifierColumnNames() ); update.setVersionColumnName( lockable.getVersionColumnName() ); update.addColumn( lockable.getVersionColumnName() ); if ( factory.getSessionFactoryOptions().isCommentsEnabled() ) { update.setComment( lockMode + " lock " + lockable.getEntityName() ); } return update.toStatementString(); }
protected String generateLockString() { final SessionFactoryImplementor factory = lockable.getFactory(); final Update update = new Update( factory.getDialect() ); update.setTableName( lockable.getRootTableName() ); update.addPrimaryKeyColumns( lockable.getRootTableIdentifierColumnNames() ); update.setVersionColumnName( lockable.getVersionColumnName() ); update.addColumn( lockable.getVersionColumnName() ); if ( factory.getSessionFactoryOptions().isCommentsEnabled() ) { update.setComment( lockMode + " lock " + lockable.getEntityName() ); } return update.toStatementString(); }