[ http://jira.andromda.org/browse/OCL-20?page=comments#action_14580 ] 

Marcos Pirmez commented on OCL-20:
----------------------------------

A syntax for injecting the distinct keyword could be "Set(User)" instead of 
"Collection(User)"

context User::findUsersByRole( roleNames:Collection(String)):Set(User) body : 
allInstances() -> select...


> Allow adding the distinct functionality in OCL queries
> ------------------------------------------------------
>
>          Key: OCL-20
>          URL: http://jira.andromda.org/browse/OCL-20
>      Project: OCL Translation
>         Type: Improvement

>   Components: AndroMDA Query
>     Reporter: Lee Greiner
>     Assignee: Chad Brandon
>     Priority: Minor

>
> HQL supports the SQL distinct keyword. There is currently no OCL query 
> support for injecting the distinct keyword in the generated HQL.
> One example:
> A User entity that has a 0..* to 1..* relationship to a Role entity.
> The OCL query
> context User::findUsersByRole( roleNames:Collection(String)):Collection(User) 
> body : allInstances() -> select ( user | roleNames  -> 
> includes(user.roles.name) )
> -> sortedBy(user.name.lastName)
> -> sortedBy(user.name.firstName)
> generates the following HQL:
> from User as user where user.roles.name in (:roleNames) order by 
> user.name.lastName, user.name.firstName
> which returns duplicate Users if a users have multiple Roles.
> Prefacing the HQL with "select distict user" returns the desired results yet 
> there is no OCL support that generates this HQL.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.andromda.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

Reply via email to