Search code examples
sql-serverspring-bootdb2hsqldb

HSQLDB Junit tes failing for DB2 and SQL Server NOLOCK queries


for our sprinboot application for junit we have used HSQL and actual database that we are using is DB2 or MS SQL Server, unfortunately in the DB2 queries we are supposed to use NOLOCK which is failing my dao related junits as HSQLDB does not support nolock.

My HSQLDB version is 2.3.3 and I guess there is some provision for ignoring no lock if so how to go about it .Or is there any work around like using some @primary bean where I can put my queries so that junit reads no lock related queries.

I am using sprinbootest runner for my junits. Aplogies as I am unable to paste my code.


Solution

  • HSQLDB supports the DB2 syntax for no lock. You need to use the latest version 2.4.1. The NOLOCK keyword is for SQL Server. DB2 uses UR

    SELECT * FROM atable WITH UR