When using derived property and using the keyword 'EXISTS' in formula, the alias of the table is prefixed to the keyword

Description

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) );

getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE);
........

Hope this can help.
regards,
Patrick

Environment

W2k - JDK 1.4.2_08 - MySQL 4.1.13

Assignee

Unassigned

Reporter

Patrick Lezy

Labels

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Suitable for new contributors

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Components

Affects versions

Priority

Major
Configure