Hi,
the semantic is exaclty the same because the OR has lower precedence
than the AND in SQL.
So...
A AND ((B AND C) OR (D AND E))
...and...
A AND (B AND C OR D AND E)
...are logically the same.
Regards,
CSharper
On 21 Jan., 16:51, Borges <[email protected]> wrote:
> Hello There!
>
> I find this hard to believe, but it seems that for an NH query of
> mine, the SQL logic
> is different than the HQL :
>
> HQL:
>
> select vi, 0 from TableA vi
> where (vi.ColumnA = ? and
> (vi.State <> ?) and
> ((vi.State in (?,?) and vi.VID = ? and vi.Mode = ?) or
> (vi.State in (?,?) and vi.VID <> ? and vi.IID = ? and
> vi.Mode = ?)))
>
> SQL where clause part captured by SQL Server Profiler:
>
> where mappedTableA.MappedColumnA=@p0 and
> mappedTableA.MappedState<>@p1 and
> ((mappedTableA.MappedState in (@p2 , @p3)) and
> mappedTableA.MappedVID=@p4 and
> mappedTableA.MappedMode=@p5 or
> (mappedTableA.MappedState in (@p6 , @p7)) and
> mappedTableA.MappedVID<>@p8 and
> mappedTableA.MappedIID_=@p9 and
> reportingw0_.MappedMode=@p10)
>
> Notice how the or in the HQL is inside brackets, while in the SQL it
> is not. So, the logic is not the same.
>
> Has anyone else encountered this issue? I am happy to prepare a test
> project to repro, but I was just wondering
> if this is a know issue? We see this with NH 2.X and NH3 (alpha).
>
> Thanks!
>
> Aaron
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.