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]>

Reply via email to