I have added this in my DAO:
@Query("SELECT distinct LBL.cId, LBL from FooBar LBL ORDER BY LBL.collectedAt DESC")
List<FooBar> findDistinctcIdOrderByCollectedAtDesc();
And then this is in my service
List<FooBar> fooBars = this.liveBusLocationDao.findDistinctcIdOrderByCollectedAtDesc();
And this is what I got when I debug contents of fooBars
fooBars = {ArrayList@11035} size = 1
0 = {Object[2]@11093}
0 = "string"
1 = {FooBar@11095} "FooBar(cId=string, internalcId=123456789012, createdAt=2011-11-02 02:59:12.208, collectedAt=2017-10-06 14:26:26.544)"
How can I traverse this result?