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