Recent H2-Dtabase CVE’s forced our team to migrate from H2 1.X.X to latest.
Here a snippet
{noformat}Double dataset = new Double[] { 2.0, 3.0, 4.0 } List<Double> list = Arrays.asList(dataset);
String query = "SELECT a " + "FROM TestEntity a " + "WHERE a.testDouble IN :param ";
Query query = getEntityManager().createQuery(query, Double.class); query.setParameter("param", list); List<TestEntity> results = query.getResultList();{noformat}
Causing
{noformat}18:58:54.051 [main] ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper - Values of types "NUMERIC(500)" and "ROW(C1 INTEGER, C2 INTEGER, C3 INTEGER)" are not comparable; SQL statement:{noformat}
After some debugs, we noticed that the hsql is translated to sql with a syntax not supported anymore by the newest H2 version.
The “in” statement is surrounded by double parentheses
{noformat}in ((2, 3, 4)){noformat}
When executing manually the generated SQL in our H2 database, it does work when replacing the double parentheses with single parenthesis, like the following
{noformat}in (2, 3, 4){noformat} |
|