hi jose, i'd like to have a clean solution providing multiple order by and their _individual ASC/DESC_ in the repository.xml. being not an xml-expert i do not know how to define this properly. also i do not know how to avoid breaking everyone's repository by adding multi order by ????
jakob ----- Original Message ----- From: "Jose Maria Lopez Lagunas" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, December 03, 2002 2:43 PM Subject: More than one field in orderby > Hi. > > I've noticed that the "orderby" attribute of "collection-descriptor" > only allows one field. I have a collection that I would want to order by > two fields. I put two fields that way: orderby="ORDEN,GTERA" but it > didn't work. I don't know if that is going to be implemented in the > future. Meanwhile I'll modify the PersistenceBrokerImpl to allow several > fields separated by commas. > > This is what I've done: > class org.apache.ojb.broker.singlevm.PersistenceBrokerImpl > ... > private void retrieveCollection(Object obj, ClassDescriptor cld, > CollectionDescriptor cds) > { > if (cds.getCascadeRetrieve()) > { > > ... > > // check if collection must be ordered > if (cds.getOrderBy() != null) > { > // My modifications /////////////////////////// > String aux; > java.util.StringTokenizer tok = new > StringTokenizer(cds.getOrderBy(),","); > while (tok.hasMoreTokens()) { > aux = tok.nextToken().trim(); > fkQuery.getCriteria().addOrderBy(aux,cds.isAscending()); > } > ///////////////////////////////////////////////////// > > // fkQuery.getCriteria().addOrderBy(cds.getOrderBy(), > cds.isAscending()); > } > ... > > } > > > > Thank you in advance. > > Jose Maria > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>