From: Alexander T. <atr...@de...> - 2006-12-18 13:30:30
|
Hello! Last week I faced with the following problem: sortOrderings() of restrictingFetchSpecfication used to fetch objects to List page were empty, but they shouldn't. The reason was that sortOrderings in named fetchSpecification were reset in ERD2WListPage.setupPhase() : log.debug("Initializing display group"); String fetchspecName =3D (String)d2wContext().valueForKey("restrictingFetchSpecification"); if(fetchspecName !=3D null) { =A0=A0=A0if(ds instanceof EODatabaseDataSource) { =A0=A0=A0=20 =A0=A0=A0((EODatabaseDataSource)ds).setFetchSpecificationByName(fetchspecName); =A0=A0=A0} } =20 ............ // AK: if we have a DB datasource, then we might want to refetc= h if the sort ordering changed // because if we have a fetch limit then the displayed matches on the first page come from the // results, not from the real order in the DB. Set "alwaysRefetchList" to false in your // rules to prevent that. if((sortOrderings !=3D null) && (ds instanceof EODatabaseDataSource)) { EOFetchSpecification fs =3D ((EODatabaseDataSource)ds).fetchSpecification(); if(!fs.sortOrderings().equals(sortOrderings)) { fs.setSortOrderings(sortOrderings); _hasToUpdate =3D _hasToUpdate ? true : alwaysRefetchList(); } } =20 So in the former or the letter case EOFetchSpecification fs =3D (EOFetchSpecification) ((EODatabaseDataSource)ds).fetchSpecification().clone(); ((EODatabaseDataSource) ds).setFetchSpecification(fs); should be used instead. Kind regards, Alexander M. Trofimchouk. |