| When criteria is declared that references another entity (requires table join), generated SQL statement uses a random alias for the joined table: occasionally, the random string begins with an integer, and this is problematic for certain databases/versions. For example, the following generated query (trimmed):
select this_.id as id1_47_1_ from users this_ inner join user_profile 3941463957x1_ on this_.iuser_id=3941463957x1_.id where (((((3941463957x1_.id=?))))) order by this_.id desc limit ?
Complains about "Syntax error at or near '.'" Next invocation of criteria succeeds because generated alias is different (begins with alpha char). This causes intermittent errors on some platforms/stacks, which are difficult to diagnose. Note:, this particular error was encountered with Grails (GORM), Hibernate4 plugin + postgres, using grails criteria builder + aliases. |