DB2 substring method needs to be exposed in DB297Dialect

Activity

Show:
Carsten Hammer
September 1, 2017, 7:18 AM

fyi: on Oracle/MSSQL I solved the substring/substr difference a different way, see

Gail Badner
September 1, 2017, 5:33 PM

, 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.

Gail Badner
September 1, 2017, 10:37 PM

Fixed in master.

Carsten Hammer
September 6, 2017, 5:18 PM

Hi Gail,
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
Best regards,
Carsten

Gail Badner
January 10, 2018, 5:45 AM

Fixed in 5.1 branch as well.

Assignee

Gail Badner

Reporter

Stephen Fikes

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure