DB2iDialect generates invalid SQL when calling merge on an entity

Hello,

We are using the DB2iDialect to connect to an IBMi system (jdbc:as400)

Since upgrading to Hibernate 6.6.36.Final - straight from 6.5 because we were waiting for a bug fix - we noticed that the following methods are failing and creating invalid SQL:

  • EntityManager β†’ merge
  • JpaRepository β†’ save

This happens when using composite keys (via @EmbeddedId) resulting in these errors:

[SQL0584] NULL or parameter marker in VALUES not allowed.

org.springframework.dao.InvalidDataAccessResourceUsageException: could not prepare statement [[SQL0584] NULL or parameter marker in VALUES not allowed.] [select cua1_0.id_column1,cua1_0.id_column2,cua1_0.column3,cua1_0.column4 from some_table cua1_0 where (cua1_0.id_column1,cua1_0.id_column2) in (select v_.c0,v_.c1 from (values (?,?)) v_(c0,c1))]; SQL [select cua1_0.id_column1,cua1_0.id_column2,cua1_0.column3,cua1_0.column4 from some_table cua1_0 where (cua1_0.id_column1,cua1_0.id_column2) in (select v_.c0,v_.c1 from (values (?,?)) v_(c0,c1))]

Unfortunately, I cannot provide a small repo to reproduce this issue because I can only run on a physical mainframe, and the Docker images I’ve found won’t start.

Fortunately, this may be clear and simple enough to understand the cause and the moment and the reason it started to change.

To your knowledge, is there any workaround besides using update queries?

Let me know if you want me to create a bug ticket on your Jira.

Please see Db2 for i regression in 6.6.30+ (HHH-19768 / row-value IN) – SQL0216 and SQL0584 on basic loads where this problem was already reported.

1 Like