]
Grep Sed commented on HHH-3458:
-------------------------------
I'm surprised that this simple bug hasn't got fixed after 3.5 years.
Register postgres random() function as "rand" in
PostgresSQLDialect
-------------------------------------------------------------------
Key: HHH-3458
URL:
https://hibernate.onjira.com/browse/HHH-3458
Project: Hibernate ORM
Issue Type: Improvement
Components: build
Affects Versions: 3.2.5
Environment: Postgres 8.3
Reporter: Stephen Cresswell
Priority: Trivial
I have an HQL query which uses "order by rand()". This works fine in our local
integration tests (which are run against hsqldb), but fails against our build integration
tests which runs postgres.
The reason the query fails is because postgres function for "rand" is called
"random". We can workaround this by dynamically detecting the db driver and
generating db specific queries, but it strikes me that the cleanest solution for this is
to simply re-register postgres' random function as "rand" in the
PostgresSQLDialect, i.e.
registerFunction( "random", new NoArgSQLFunction("random",
Hibernate.DOUBLE) );
registerFunction( "rand", new NoArgSQLFunction("random",
Hibernate.DOUBLE) );
--
This message is automatically generated by JIRA.
For more information on JIRA, see: