cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felipe Martín Santos <gadita...@gmail.com>
Subject Re: Problem - fetching the Distinct rows based on a Property
Date Tue, 30 Oct 2012 11:09:55 GMT
// Extract is the obj-entity you have for the T_QC_EXTRACT db-entity
SQLTemplate query = new SQLTemplate(Extract.class, "SELECT DISTINCT
STORY_ID FROM T_QC_EXTRACT WHERE EXECUTION_STATUS IN ('PASSED','BLOCKED')");

SQLResult resultDescriptor = new SQLResult();
resultDescriptor.addColumnResult("STORY_ID");
query.setResult(resultDescriptor);

List<DataObject> dataObjects = context.performQuery(query);


Is this what you need??

You can see more here:
http://cayenne.apache.org/doc/sqltemplate-result-mapping.html


2012/10/30 Sampath Uppula <SU0064323@techmahindra.com>

> Hi,
>
> I have  a table T_QC_EXTRACT with many columns, few of them are STORY_ID,
> EXECUTION_STATUS.
> I want to fetch the distinct STORY_ID based on EXECUTION_STATUS IN
> ('PASSED','BLOCKED');
>
> SELECT DISTINCT STORY_ID FROM T_QC_EXTRACT WHERE EXECUTION_STATUS IN
> ('PASSED','BLOCKED');
>
> Please suggest a way to achieve this using Cayenne.
>
> Thanks,
> Sampath Uppula
>
> ============================================================================================================================Disclaimer:
>  This message and the information contained herein is proprietary and
> confidential and subject to the Tech Mahindra policy statement, you may
> review the policy at <a href="http://www.techmahindra.com/Disclaimer.html
> ">http://www.techmahindra.com/Disclaimer.html</a> externally and <a href="
> http://tim.techmahindra.com/tim/disclaimer.html">
> http://tim.techmahindra.com/tim/disclaimer.html</a> internally within
> Tech
> Mahindra.============================================================================================================================

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message