The DB2 dialect translates substring in HQL to substr and hides the DB2 method substring
See IBM documentation for valid method signatures
fyi: on Oracle/MSSQL I solved the substring/substr difference a different way, see
, I'm not sure you dealt with the similar problem.
DB2 has both "substr" and "substring", which are different functions that are not interchangeable due to having different arguments. Before the fix, Hibernate rendered both "substr" and "substring" in HQL as "substr", so it was impossible to use the DB2 "substring" function in HQL.
The fix I propose looks at the arguments to "substring" method to determine which function should actually be used.
Fixed in master.
you are right. My problem was to have a database independent solution to allow paging in a large result set with a large column (CLOB). So I needed a formula annotion that provides the shortened content of the column on all supported databases. As there is no way to create a dialect specific formula annotation I had to solve it using the database-object xml entity that can be dialect specific.
But regarding database independent usage: doesn't your solution add another problem to the goal of database independent hql queries? Maybe I am the only one who needs this
Fixed in 5.1 branch as well.