[hibernate-dev] Are the tests in the documentation module expected to run on MySQL only?
Mark Rotteveel
mark at lawinegevaar.nl
Fri Sep 8 12:41:12 EDT 2017
Are the tests in the documentation module expected to run on MySQL /
MariaDB only? Or are they expected to run on all databases?
The test org.hibernate.userguide.mapping.basic.SubselectTest is failing
on Firebird, because it has the following subselect:
@Subselect(
"select " +
" a.id as id, " +
" concat(concat(c.first_name, ' '), c.last_name) as clientName, " +
" sum(at.cents) as balance " +
"from account a " +
"join client c on c.id = a.client_id " +
"join account_transaction at on a.id = at.account_id " +
"group by a.id, concat(concat(c.first_name, ' '), c.last_name)"
)
Firebird doesn't have a concat function. According to the version
history, this test previously used the SQL standard concat operator
'||', but this was changed in May with the commit comment "Fix test
failing on MariaDB".
I am surprised that this change wouldn't be failing on other databases
either (unless most of them define a concat function next to supporting
the || operator).
To fix this database independently, it would need to be changed to use
the JDBC concat function escape:
@Subselect(
"select " +
" a.id as id, " +
" {fn concat({fn concat(c.first_name, ' ')}, c.last_name)} as
clientName, " +
" sum(atr.cents) as balance " +
"from account a " +
"join client c on c.id = a.client_id " +
"join account_transaction atr on a.id = atr.account_id " +
"group by a.id, {fn concat({fn concat(c.first_name, ' ')},
c.last_name)}"
)
However, JDBC function escape are (almost) never used in Hibernate
tests, so I wonder if this would need to be handled elsewhere.
What to do? Do I ignore the documentation tests, add an exception for
Firebird or create a pull request with the above change, or something else?
--
Mark Rotteveel
More information about the hibernate-dev
mailing list