I use a derived property in a module. The formula use subqueries in an EXISTS clause.
I got an error from the JDBC connection saying the syntax of my SQL statement is not correct. While checking, I saw that the EXISTS keyword has been prefixed with the table alias : table.EXISTS( SELECT blah FROM ... ).
In order to solve my problem, I created a copy of the MySQLDialect.java class and I have added the EXISTS statement as an SQL statement returning a boolean.
I don't know if I did it right but this solved my problem and can be the case for other databases.
registerFunction("sha1", new StandardSQLFunction(Hibernate.STRING) );
registerFunction("sha", new StandardSQLFunction(Hibernate.STRING) );
// add a function for the exists keyword
registerFunction("exists", new StandardSQLFunction(Hibernate.BOOLEAN) );
Hope this can help.
W2k - JDK 1.4.2_08 - MySQL 4.1.13