How to use DISTINCT in repositories

644 views
Skip to first unread message

anujjaiswal

unread,
Feb 19, 2010, 11:39:16 AM2/19/10
to ATG_Tech
How can i use DISTINCT using ATG Repositories. For example: Select
DISTINCT name from employee_table;

russel...@mac.com

unread,
Feb 20, 2010, 5:50:03 PM2/20/10
to ATG_Tech
In Repository API, you get back a collection of objects
(RepositoryItems), and generally those RepositoryItems are unique,
even if they have the same data because they should have a unique ID,
so there is no direct way to say give me all objects with a unique
name property.Generally, if you need distinct in a query, you should
examine your repository structure to see if it is defining the data
logically to begin with. You should probably never have 2 employee
repository items with the same name as below (unless you have two
employees with the same name, at which point it is indeterminate which
employee you will get back).

You can. however, use a SQLPassThroughQuery to override the RQL-
generated sql. There are constraints - you still need to get back
RepositoryItems, but you could say give me all employees with a unique
name. Look at "Overriding RQL-Generated SQL" in the repository guide.

Note that the sQL you write may no longer be portable, and thereby
cause issues if you develop against one platform and deploy against
another.

Anuj Jaiswal

unread,
Feb 20, 2010, 9:27:53 PM2/20/10
to atg_...@googlegroups.com
Thanks Russel, I got your point.

--
You received this message because you are subscribed to the Google Groups "ATG_Tech" group.
To post to this group, send email to atg_...@googlegroups.com
To unsubscribe from this group, send email to atg_tech-u...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/atg_tech?hl=en



--
Thanks and Regards,
Anuj Jaiswal
+919899331803
Reply all
Reply to author
Forward
0 new messages