protected String generateLockString() {
   SessionFactoryImplementor factory = lockable.getFactory();
   Update update = new Update(factory.getDialect());
   update.setTableName(lockable.getRootTableName());
   update.addPrimaryKeyColumns(lockable.getRootTableIdentifierColumnNames());
   update.setVersionColumnName(lockable.getVersionColumnName());
   update.addColumn(lockable.getVersionColumnName());
   if (factory.getSettings().isCommentsEnabled()) {
     update.setComment(lockMode + " lock " + lockable.getEntityName());
   }
   return update.toStatementString();
 }
예제 #2
0
 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();
 }