Java Code Examples for org.hibernate.sql.Update#addPrimaryKeyColumns()
The following examples show how to use
org.hibernate.sql.Update#addPrimaryKeyColumns() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OneToManyPersister.java From lams with GNU General Public License v2.0 | 6 votes |
/** * 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(); }
Example 2
Source File: ReactiveAbstractEntityPersister.java From hibernate-reactive with GNU Lesser General Public License v2.1 | 5 votes |
default String generateUpdateLockString(LockOptions lockOptions) { final SessionFactoryImplementor factory = getFactory(); Dialect dialect = factory.getJdbcServices().getDialect(); final Update update = new Update(dialect); update.setTableName( getRootTableName() ); update.addPrimaryKeyColumns( getRootTableIdentifierColumnNames() ); update.setVersionColumnName( getVersionColumnName() ); update.addColumn( getVersionColumnName() ); if ( factory.getSessionFactoryOptions().isCommentsEnabled() ) { update.setComment( lockOptions.getLockMode() + " lock " + getEntityName() ); } return update.toStatementString(); }
Example 3
Source File: AbstractEntityPersister.java From lams with GNU General Public License v2.0 | 5 votes |
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(); }
Example 4
Source File: BasicCollectionPersister.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Generate the SQL UPDATE that updates a row */ @Override protected String generateUpdateRowString() { final Update update = new Update( getDialect() ) .setTableName( qualifiedTableName ); //if ( !elementIsFormula ) { update.addColumns( elementColumnNames, elementColumnIsSettable, elementColumnWriters ); //} if ( hasIdentifier ) { update.addPrimaryKeyColumns( new String[] {identifierColumnName} ); } else if ( hasIndex && !indexContainsFormula ) { update.addPrimaryKeyColumns( ArrayHelper.join( keyColumnNames, indexColumnNames ) ); } else { update.addPrimaryKeyColumns( keyColumnNames ); update.addPrimaryKeyColumns( elementColumnNames, elementColumnIsInPrimaryKey, elementColumnWriters ); } if ( getFactory().getSessionFactoryOptions().isCommentsEnabled() ) { update.setComment( "update collection row " + getRole() ); } return update.toStatementString(); }
Example 5
Source File: UpdateLockingStrategy.java From lams with GNU General Public License v2.0 | 5 votes |
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(); }
Example 6
Source File: PessimisticWriteUpdateLockingStrategy.java From lams with GNU General Public License v2.0 | 5 votes |
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(); }
Example 7
Source File: PessimisticReadUpdateLockingStrategy.java From lams with GNU General Public License v2.0 | 5 votes |
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(); }