Dynamic SQL object query

From: Marek Šab (msab..uk.cvut.cz)
Date: Fri Nov 12 2010 - 22:40:58 UTC

  • Next message: bogdan_voloshincu: ""overwrite=true" issue"

    Hi all,

    I would like to ask few questions. I need to determine count of all
    users depending on multivalued form filter.

    Before trying I already knew this won't work:

             new SQLTemplate(User.class, "SELECT #result('COUNT(id)' 'Long'
    'count') from User #chain('AND' 'WHERE') #chunk($userId) id =
    #bind($userId) #end #chunk($userName) userInfo.name LIKE $userName #end
    #end");

    becuase of "userInfo.name" which is object-style. So my first question
    is whether there is a way of accomplishing this with EJBQL so I don't
    have to work with joins there.

    Second, what is the difference between #bind($a) and just $a. Both works
    and I suppose it's close to similar.

    And last, which is just informative, the parameters can't contain '.',
    like $userInfo.name, because of parser?

    Best regards,

    -- 
    Marek Šabo
    



    This archive was generated by hypermail 2.0.0 : Fri Nov 12 2010 - 23:41:31 UTC