IS [NOT] NULL checks with component values

Description

Currently the HQL translator attempts to render IS NULL and IS NOT NULL checks against a component using tuple syntax. Would be much better to instead "explode" these.

For example, consider Person with a name property which is a component type of Name and the HQL:
"from Person p where p.name is null"

Currently, we'd end up with SQL like:
"... from person p where (p.f_name, p.l_name) is null"

but the exploded form would make much more sense here:
"... from person p where ( p.f_name is null and p.l_name is null )"

Environment

None

Activity

Show:
Steve Ebersole
October 17, 2007, 9:55 PM

Note to self:

1) IS NULL should get expanded with AND

Consider:
from Person p where p.name is null

The implication here is we want persons where all parts of their name are null:
select ... from person p where (p.f_name is null and p.l_name is null)

2) IS NOT NULL should get expanded with OR

Consider:
from Person p where p.name is not null

Here, the implication is that not (all parts of their name are null); if any part of the name is not null then this check should logically succeed
select ... from person p where (p.f_name is not null or p.l_name is not null)

the above being functionally equivalent to:
select ... from person p where not ( p.f_name is null and p.l_name is null )

Steve Ebersole
October 17, 2007, 11:02 PM

trunk / 3.2

Strong Liu
November 2, 2009, 11:04 AM
Steve Ebersole
March 21, 2011, 7:04 PM

Bulk closing stale resolved issues

Assignee

Steve Ebersole

Reporter

Steve Ebersole

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Priority

Major
Configure