Thanks for the reply - 

I guess the problem is that in the DAO we do something like:

getHibernateTemplates.findByCriteria......


This doesnt work for me :( - I d much rather write the sql statement from
scratch like select colA from myTable....

Is this possible?


Vincent Ramdhanie wrote:
> 
> I don't think that a group by is designed to remove duplicates, you
> probably
> want to select distinct. However, in Hibernate if you are using eager
> fetching you might still end up with duplicates so you may have to remove
> them yourself.
> 
> This topic might provide some clues:
> http://www.javalobby.org/java/forums/t68781.html
> 
> Vincent
> 
> On Fri, Sep 12, 2008 at 6:42 AM, Joey122  wrote:
> 
>>  I ve been blown away by how neat Appfuse is and its been a great
>> kickstart.
>>
>> I m trying to ensure that duplicates are removed from the data returned
>> by
>> hibernate by forcing a group by - So far I ve tried to use the Projection
>> group property on the criteria as follows:
>>
>>  criteria.setProjection(Projections.projectionList().add(
>> Projections.groupProperty("landlord_details").as(
>> "landlord_details")).add(
>> Projections.groupProperty("landlord_agent_details").as(
>> "landlord_agent_details")));
>>
>> However this no longer returns all the data I need and only returns the
>> columns which I have grouped by which is wrong :(
>>
>> Can anyone give a pointer on how to force a group by on certain columns
>> whilst still keeping all the other columns that I need?
>> ------------------------------
>> View this message in context: Forcing A Group By In Hibernate
>> Sent from the AppFuse - User mailing list archiveat Nabble.com.
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Forcing-A-Group-By-In-Hibernate-tp19453450s2369p19464442.html
Sent from the AppFuse - User mailing list archive at Nabble.com.

Reply via email to