Bug in io.jmix.data.impl.dbms.HsqlSequenceSupport

public String getCurrentValueSql(String sequenceName) {
        return "select START_WITH from INFORMATION_SCHEMA.SYSTEM_SEQUENCES where SEQUENCE_NAME = '"
                + sequenceName.toUpperCase() + "'";
    }

calling getCurrentValueSql returns always the sequence’ starting value instead of the current value.

I think it would work by replacing sql code with:
"call current value for '" + sequenceName.toUpperCase() + "'";

or

"select (CAST(next_value AS INTEGER) - 1) from INFORMATION_SCHEMA.SYSTEM_SEQUENCES where SEQUENCE_NAME = '" + sequenceName.toUpperCase() + "'";

Hello Fulvio,

Thank you for reporting the problem and suggesting solutions! The issue has been created.

Regards,
Dmitry

1 Like