Firebird has a problem with some of the SQL generated by Hibernate, in some queries Hibernate appends StringHelper.WHITESPACE between conditions (specifically in CollectionBinder.bindFilters(boolean)).
The problem is that StringHelper.WHITESPACE contains a formfeed (\f, 0x0C), and Firebird does not accept a formfeed as whitespace.
It looks like the usage of StringHelper.WHITESPACE is wrong; the other places this constant is used is for splitting/tokenizing strings, and not for adding whitespace.
This was introduced in commit bf9b3f524d271eaf055cfda4f66a7a3acb714c0d for HHH-6781 Closed in 5.2.0.
I will create a PR for this shortly