{
JetspeedPreferencesMap map = new JetspeedPreferencesMap();
Criteria c = new Criteria();
c.addEqualTo("dtype", DISCRIMINATOR_USER);
String previousKey = "";
QueryByCriteria query = QueryFactory.newQuery(DatabasePreference.class, c);
query.addOrderByAscending("dtype");
query.addOrderByAscending("applicationName");
query.addOrderByAscending("portletName");
query.addOrderByAscending("entityId");
query.addOrderByAscending("userName");
Iterator<DatabasePreference> preferences = getPersistenceBrokerTemplate().getIteratorByQuery(query);
while (preferences.hasNext())
{
DatabasePreference preference = preferences.next();
String cacheKey = getUserPreferenceKey(preference.getApplicationName(), preference.getPortletName(), preference.getEntityId(), preference.getUserName());