/** * Generate the SQL that selects the version number by id */ protected String generateSelectVersionString() { SimpleSelect select = new SimpleSelect( getFactory().getDialect() ) .setTableName( getVersionedTableName() ); if ( isVersioned() ) { select.addColumn( versionColumnName ); } else { select.addColumns( rootTableKeyColumnNames ); } if ( getFactory().getSessionFactoryOptions().isCommentsEnabled() ) { select.setComment( "get version " + getEntityName() ); } return select.addCondition( rootTableKeyColumnNames, "=?" ).toStatementString(); }
protected String generateLockString(int lockTimeout) { final SessionFactoryImplementor factory = getLockable().getFactory(); final LockOptions lockOptions = new LockOptions( getLockMode() ); lockOptions.setTimeOut( lockTimeout ); final SimpleSelect select = new SimpleSelect( factory.getDialect() ) .setLockOptions( lockOptions ) .setTableName( getLockable().getRootTableName() ) .addColumn( getLockable().getRootTableIdentifierColumnNames()[0] ) .addCondition( getLockable().getRootTableIdentifierColumnNames(), "=?" ); if ( getLockable().isVersioned() ) { select.addCondition( getLockable().getVersionColumnName(), "=?" ); } if ( factory.getSessionFactoryOptions().isCommentsEnabled() ) { select.setComment( getLockMode() + " lock " + getLockable().getEntityName() ); } return select.toStatementString(); } }
protected String generateLockString(int timeout) { final SessionFactoryImplementor factory = getLockable().getFactory(); final LockOptions lockOptions = new LockOptions( getLockMode() ); lockOptions.setTimeOut( timeout ); final SimpleSelect select = new SimpleSelect( factory.getDialect() ) .setLockOptions( lockOptions ) .setTableName( getLockable().getRootTableName() ) .addColumn( getLockable().getRootTableIdentifierColumnNames()[0] ) .addCondition( getLockable().getRootTableIdentifierColumnNames(), "=?" ); if ( getLockable().isVersioned() ) { select.addCondition( getLockable().getVersionColumnName(), "=?" ); } if ( factory.getSessionFactoryOptions().isCommentsEnabled() ) { select.setComment( getLockMode() + " lock " + getLockable().getEntityName() ); } return select.toStatementString(); } }
protected String generateLockString(int lockTimeout) { final SessionFactoryImplementor factory = getLockable().getFactory(); final LockOptions lockOptions = new LockOptions( getLockMode() ); lockOptions.setTimeOut( lockTimeout ); final SimpleSelect select = new SimpleSelect( factory.getDialect() ) .setLockOptions( lockOptions ) .setTableName( getLockable().getRootTableName() ) .addColumn( getLockable().getRootTableIdentifierColumnNames()[0] ) .addCondition( getLockable().getRootTableIdentifierColumnNames(), "=?" ); if ( getLockable().isVersioned() ) { select.addCondition( getLockable().getVersionColumnName(), "=?" ); } if ( factory.getSessionFactoryOptions().isCommentsEnabled() ) { select.setComment( getLockMode() + " lock " + getLockable().getEntityName() ); } return select.toStatementString(); } }
select.setComment( "load " + getEntityName() );
/** * Generate the SQL that selects the version number by id */ protected String generateSelectVersionString() { SimpleSelect select = new SimpleSelect( getFactory().getDialect() ) .setTableName( getVersionedTableName() ); if ( isVersioned() ) { select.addColumn( versionColumnName ); } else { select.addColumns( rootTableKeyColumnNames ); } if ( getFactory().getSettings().isCommentsEnabled() ) select.setComment( "get version " + getEntityName() ); return select.addCondition( rootTableKeyColumnNames, "=?" ).toStatementString(); }
/** * Generate the SQL that selects the version number by id */ protected String generateSelectVersionString() { SimpleSelect select = new SimpleSelect( getFactory().getDialect() ) .setTableName( getVersionedTableName() ); if ( isVersioned() ) { select.addColumn( versionColumnName ); } else { select.addColumns( rootTableKeyColumnNames ); } if ( getFactory().getSettings().isCommentsEnabled() ) { select.setComment( "get version " + getEntityName() ); } return select.addCondition( rootTableKeyColumnNames, "=?" ).toStatementString(); }
/** * Generate the SQL that selects the version number by id */ protected String generateSelectVersionString() { SimpleSelect select = new SimpleSelect( getFactory().getDialect() ) .setTableName( getVersionedTableName() ); if ( isVersioned() ) { select.addColumn( versionColumnName ); } else { select.addColumns( rootTableKeyColumnNames ); } if ( getFactory().getSettings().isCommentsEnabled() ) { select.setComment( "get version " + getEntityName() ); } return select.addCondition( rootTableKeyColumnNames, "=?" ).toStatementString(); }
protected String generateLockString() { SessionFactoryImplementor factory = lockable.getFactory(); SimpleSelect select = new SimpleSelect( factory.getDialect() ) .setLockMode( lockMode ) .setTableName( lockable.getRootTableName() ) .addColumn( lockable.getRootTableIdentifierColumnNames()[0] ) .addCondition( lockable.getRootTableIdentifierColumnNames(), "=?" ); if ( lockable.isVersioned() ) { select.addCondition( lockable.getVersionColumnName(), "=?" ); } if ( factory.getSettings().isCommentsEnabled() ) { select.setComment( lockMode + " lock " + lockable.getEntityName() ); } return select.toStatementString(); } }
/** * Generate the SQL that pessimistic locks a row by id (and version) */ protected String generateLockString(LockMode lockMode) { SimpleSelect select = new SimpleSelect( getFactory().getDialect() ) .setLockMode( lockMode ) .setTableName( getVersionedTableName() ) .addColumn( rootTableKeyColumnNames[0] ) .addCondition( rootTableKeyColumnNames, "=?" ); if ( isVersioned() ) { select.addWhereToken( "and" ) .addCondition( getVersionColumnName(), "=?" ); } if ( getFactory().getSettings().isCommentsEnabled() ) { select.setComment( "lock " + getEntityName() ); } return select.toStatementString(); }
protected String generateLockString(int lockTimeout) { final SessionFactoryImplementor factory = getLockable().getFactory(); final LockOptions lockOptions = new LockOptions( getLockMode() ); lockOptions.setTimeOut( lockTimeout ); final SimpleSelect select = new SimpleSelect( factory.getDialect() ) .setLockOptions( lockOptions ) .setTableName( getLockable().getRootTableName() ) .addColumn( getLockable().getRootTableIdentifierColumnNames()[0] ) .addCondition( getLockable().getRootTableIdentifierColumnNames(), "=?" ); if ( StringHelper.isNotEmpty( getLockable().getVersionColumnName() ) ) { select.addCondition( getLockable().getVersionColumnName(), "=?" ); } if ( factory.getSessionFactoryOptions().isCommentsEnabled() ) { select.setComment( getLockMode() + " lock " + getLockable().getEntityName() ); } return select.toStatementString(); } }
protected String generateLockString(int lockTimeout) { SessionFactoryImplementor factory = getLockable().getFactory(); LockOptions lockOptions = new LockOptions( getLockMode() ); lockOptions.setTimeOut( lockTimeout ); SimpleSelect select = new SimpleSelect( factory.getDialect() ) .setLockOptions( lockOptions ) .setTableName( getLockable().getRootTableName() ) .addColumn( getLockable().getRootTableIdentifierColumnNames()[0] ) .addCondition( getLockable().getRootTableIdentifierColumnNames(), "=?" ); if ( getLockable().isVersioned() ) { select.addCondition( getLockable().getVersionColumnName(), "=?" ); } if ( factory.getSettings().isCommentsEnabled() ) { select.setComment( getLockMode() + " lock " + getLockable().getEntityName() ); } return select.toStatementString(); } }
protected String generateLockString(int lockTimeout) { SessionFactoryImplementor factory = getLockable().getFactory(); LockOptions lockOptions = new LockOptions( getLockMode() ); lockOptions.setTimeOut( lockTimeout ); SimpleSelect select = new SimpleSelect( factory.getDialect() ) .setLockOptions( lockOptions ) .setTableName( getLockable().getRootTableName() ) .addColumn( getLockable().getRootTableIdentifierColumnNames()[0] ) .addCondition( getLockable().getRootTableIdentifierColumnNames(), "=?" ); if ( getLockable().isVersioned() ) { select.addCondition( getLockable().getVersionColumnName(), "=?" ); } if ( factory.getSettings().isCommentsEnabled() ) { select.setComment( getLockMode() + " lock " + getLockable().getEntityName() ); } return select.toStatementString(); } }
protected String generateLockString(int timeout) { SessionFactoryImplementor factory = getLockable().getFactory(); LockOptions lockOptions = new LockOptions( getLockMode() ); lockOptions.setTimeOut( timeout ); SimpleSelect select = new SimpleSelect( factory.getDialect() ) .setLockOptions( lockOptions ) .setTableName( getLockable().getRootTableName() ) .addColumn( getLockable().getRootTableIdentifierColumnNames()[0] ) .addCondition( getLockable().getRootTableIdentifierColumnNames(), "=?" ); if ( getLockable().isVersioned() ) { select.addCondition( getLockable().getVersionColumnName(), "=?" ); } if ( factory.getSettings().isCommentsEnabled() ) { select.setComment( getLockMode() + " lock " + getLockable().getEntityName() ); } return select.toStatementString(); } }
protected String generateLockString(int timeout) { SessionFactoryImplementor factory = getLockable().getFactory(); LockOptions lockOptions = new LockOptions( getLockMode() ); lockOptions.setTimeOut( timeout ); SimpleSelect select = new SimpleSelect( factory.getDialect() ) .setLockOptions( lockOptions ) .setTableName( getLockable().getRootTableName() ) .addColumn( getLockable().getRootTableIdentifierColumnNames()[0] ) .addCondition( getLockable().getRootTableIdentifierColumnNames(), "=?" ); if ( getLockable().isVersioned() ) { select.addCondition( getLockable().getVersionColumnName(), "=?" ); } if ( factory.getSettings().isCommentsEnabled() ) { select.setComment( getLockMode() + " lock " + getLockable().getEntityName() ); } return select.toStatementString(); } }
protected String generateLockString(int lockTimeout) { SessionFactoryImplementor factory = getLockable().getFactory(); LockOptions lockOptions = new LockOptions( getLockMode() ); lockOptions.setTimeOut( lockTimeout ); SimpleSelect select = new SimpleSelect( factory.getDialect() ) .setLockOptions( lockOptions ) .setTableName( getLockable().getRootTableName() ) .addColumn( getLockable().getRootTableIdentifierColumnNames()[0] ) .addCondition( getLockable().getRootTableIdentifierColumnNames(), "=?" ); if ( getLockable().isVersioned() ) { select.addCondition( getLockable().getVersionColumnName(), "=?" ); } if ( factory.getSettings().isCommentsEnabled() ) { select.setComment( getLockMode() + " lock " + getLockable().getEntityName() ); } return select.toStatementString(); } }
protected String generateLockString(int lockTimeout) { SessionFactoryImplementor factory = getLockable().getFactory(); LockOptions lockOptions = new LockOptions( getLockMode() ); lockOptions.setTimeOut( lockTimeout ); SimpleSelect select = new SimpleSelect( factory.getDialect() ) .setLockOptions( lockOptions ) .setTableName( getLockable().getRootTableName() ) .addColumn( getLockable().getRootTableIdentifierColumnNames()[0] ) .addCondition( getLockable().getRootTableIdentifierColumnNames(), "=?" ); if ( getLockable().isVersioned() ) { select.addCondition( getLockable().getVersionColumnName(), "=?" ); } if ( factory.getSettings().isCommentsEnabled() ) { select.setComment( getLockMode() + " lock " + getLockable().getEntityName() ); } return select.toStatementString(); } }
protected String generateLockString(int lockTimeout) { final SessionFactoryImplementor factory = getLockable().getFactory(); final LockOptions lockOptions = new LockOptions( getLockMode() ); lockOptions.setTimeOut( lockTimeout ); final SimpleSelect select = new SimpleSelect( factory.getDialect() ) .setLockOptions( lockOptions ) .setTableName( getLockable().getRootTableName() ) .addColumn( getLockable().getRootTableIdentifierColumnNames()[0] ) .addCondition( getLockable().getRootTableIdentifierColumnNames(), "=?" ); if ( StringHelper.isNotEmpty( getLockable().getVersionColumnName() ) ) { select.addCondition( getLockable().getVersionColumnName(), "=?" ); } if ( factory.getSessionFactoryOptions().isCommentsEnabled() ) { select.setComment( getLockMode() + " lock " + getLockable().getEntityName() ); } return select.toStatementString(); } }
protected String generateLockString(int timeout) { final SessionFactoryImplementor factory = getLockable().getFactory(); final LockOptions lockOptions = new LockOptions( getLockMode() ); lockOptions.setTimeOut( timeout ); final SimpleSelect select = new SimpleSelect( factory.getDialect() ) .setLockOptions( lockOptions ) .setTableName( getLockable().getRootTableName() ) .addColumn( getLockable().getRootTableIdentifierColumnNames()[0] ) .addCondition( getLockable().getRootTableIdentifierColumnNames(), "=?" ); if ( StringHelper.isNotEmpty( getLockable().getVersionColumnName() ) ) { select.addCondition( getLockable().getVersionColumnName(), "=?" ); } if ( factory.getSessionFactoryOptions().isCommentsEnabled() ) { select.setComment( getLockMode() + " lock " + getLockable().getEntityName() ); } return select.toStatementString(); } }
select.setComment( "load " + getEntityName() );