You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by Andrus Adamchik <an...@objectstyle.org> on 2008/12/01 20:07:48 UTC

Deprecating SelectQuery custom attributes option

Another thing I'd like to officially tag as "legacy" - SelectQuery  
"customDbAttributes" option that would allow to fetch a subset of  
columns as a DataRow. It's always been a hack and now there is a more  
or less direct replacement - EJBQL that allows to select individual  
*object* attributes. In fact it is more powerful, as it allows to  
traverse relationships:

   String ejbql = "select p.estimatedPrice, p.toArtist.artistName from  
Painting p order by p.estimatedPrice";
   EJBQLQuery query = new EJBQLQuery(ejbql);
   List<Object[]> data = context.performQuery(query);

Also note that the returned result consists of Object[]'s, not  
DataRows. This can be much easier to parse in the calling code in many  
situations (with this morning trunk commits, potentially any type of  
query can generate an Object[] result... I'd like to start using that  
myself to get a feel of how much more usable this is compared to  
DataRows. Certainly less wasteful CPU and memory-wise).

Anyways, unless I hear strong objections, I am going to deprecate  
SelectQuery custom attributes.

Andrus