@Formula adds a this_. prefix to an SQL function

Description

With Hibernate 3.5.2 the ISNULL/COALESCE SQL statement in the following @Formula is prefixed with a this_. An so its no valid SQL.

The annotation:
@Formula( "(SELECT ISNULL ( (SELECT 1 WHERE EXISTS (SELECT * FROM org.usertable as user WHERE user.user_id = user_id)), 0))" )

The SQL part for this formula:
(SELECT this_.ISNULL ( (SELECT 1 WHERE EXISTS (SELECT * FROM org.usertable as user WHERE user.user_id = this_.user_id)), 0)) as formula8_1_,

-> thats invalid SQL

In Hibernate 3.5.1 the SQL is pretty the same, but without this_. before ISNULL.
(SELECT ISNULL ( (SELECT 1 WHERE EXISTS (SELECT * FROM org.usertable as user WHERE user.user_id = this_.user_id)), 0)) as formula8_1_,

Activity

Show:

Brett MeyerJuly 8, 2014 at 3:10 PM

Bulk rejecting stale issues. If this is still a legitimate issue on ORM 4, feel free to comment and attach a test case. I'll address responses case-by-case. Thanks!

Brett MeyerApril 7, 2014 at 5:44 PM

In an effort to clean up, in bulk, tickets that are most likely out of date, we're transitioning all ORM 3 tickets to an "Awaiting Test Case" state. Please see http://in.relation.to/Bloggers/HibernateORMJIRAPoliciesAndCleanUpTactics for more information.

If this is still a legitimate bug in ORM 4, please provide either a test case that reproduces it or enough detail (entities, mappings, snippets, etc.) to show that it still fails on 4. If nothing is received within 3 months or so, we'll be automatically closing them.

Thank you!

Matthias BosshardDecember 23, 2010 at 5:45 PM
Edited

I finally found the problem. If there is a white-space between ISNULL and the parenthesis, the isFunction method in the Template class returns a false.
So when I remove the spaces it works for me. But it should working with and without white-spaces.

Rejected

Details

Assignee

Reporter

Components

Affects versions

Priority

Created May 26, 2010 at 10:59 AM
Updated April 22, 2015 at 6:24 PM
Resolved July 8, 2014 at 3:10 PM

Flag notifications