I think your confusion is from the bug that I'm trying to solve right now: single argument in columns() method leads to erroneous result: return type is declared like Object[] but actual result is single Object. This shouldn't happen as columns() method should always return Object[] regardless argument count. Only way to have single Object in result is explicitly call column() or corresponding factory method ColumnSelect.query(EntityClass.class, singleProperty).
And I'm implementing fetchDataRow() support for the ColumnSelect too. So I hope it will reduce inconsistency in new API. On Mon, Jan 16, 2017 at 12:41 PM, Hugi Thordarson <h...@karlmenn.is> wrote: > Hi all, > > I’ve been using the new column select API for the past week days and I’m > loving it so far. > > One thing that I find a little bothersome (and at times confusing) when using > these APIs though is how return types change based on what you’re fetching, > especially how the type will change between List<Object> to List<Object[]> > based on if I’m fetching multiple columns or a single column (I see this was > discussed a little on the list the other day). As an API consumer I think it > would be much nicer if fetches consistently returned List<Object[]>. > > If this isn’t possible, might a possible workaround be to make DataRow > fetches always return DataRows? That would allow me to stick to a single API > and have consistent results from fetches, regardless of whether I’m limiting > myself to a set of columns. Example: > > List<DataRow> list = ObjectSelect.dataRowQuery( Entry.class ) > .where( Entry.RECEIPT.dot( Receipt.USER > ).dot( User.NAME ).eq( "Hugi Þórðarson" ) ) > .columns( Entry.TEXT, Entry.PRICE ) > .select( someObjectContext() ); > > for( DataRow entry : list ) { > System.out.println( entry.get( "text" ) ); > } > > Cheers, > - hugi -- Best regards, Nikita Timofeev