Opened 5 years ago

Closed 5 years ago

#2140 closed defect (fixed)

Hql.sharedTo() generates incorrect HQL

Reported by: Nicklas Nordborg Owned by: everyone
Priority: major Milestone: BASE 3.13.1
Component: core Version:
Keywords: Cc:


The Hql.sharedTo() method is used to restrict items returned by a query based on which users/groups/projects they are shared to. When this method is used and only the projects parameter is user it generates an incorrect query which causes an exception:

  unexpected token: OR near line 1, column 87 
    [ SELECT bs FROM bs 
      WHERE ( = :name) AND 
      ( OR (bs.projectKey IN (select from      <<< Extra "OR"   prj 
         JOIN prj.projectKeys pk where ( = 2312857)))

The problem is the OR operator on the line that is marked above. It should not be inserted if both the users and groups parameters are null.

Change History (1)

comment:1 by Nicklas Nordborg, 5 years ago

Resolution: fixed
Status: newclosed

(In [7550]) Fixes #2140: Hql.sharedTo() generates incorrect HQL

Note: See TracTickets for help on using tickets.