 				
 				function handleRootIds(event:ResultEvent, entityType:int):void
 				{
-					var query:AsyncToken = dataService.getEntitiesById(event.result as Array);
-					addAsyncResponder(query, handleRootEntities, handleFault, entityType);
-				}
-				function handleRootEntities(event:ResultEvent, entityType:int):void
-				{
+					var ids:Array = event.result as Array;
+					var query:AsyncToken = dataService.getEntitiesById(ids);
+					addAsyncResponder(query, handleRootEntities, handleFault, [entityType, ids]);
+				}
+				function handleRootEntities(event:ResultEvent, entityType_entityIds:Array):void
+				{
+					var entityType:int = entityType_entityIds[0];
+					var entityIds:Array = entityType_entityIds[1];
+					
+					var entities:Array = event.result as Array;
+					entities.sort(
+						function(entity1:Object, entity2:Object):int
+						{
+							var i1:int = entityIds.indexOf(entity1.id);
+							var i2:int = entityIds.indexOf(entity2.id);
+							return ObjectUtil.numericCompare(i1, i2);
+						}
+					);
+					
 					if (entityType == EntityType.TABLE)
-						_tableEntities = event.result as Array;
+						_tableEntities = entities;
 					else
-						_geometryEntities = event.result as Array;
+						_geometryEntities = entities;
 					
 					// only proceed when we have both
 					if (!_tableEntities || !_geometryEntities)

			var leafNode:XML = HierarchyUtils.getLeafNodeFromPath(pathInHierarchy) || <empty/>;
			proxyColumn.setMetadata(leafNode.copy());
			
			var params:Object = new Object();
			var queryProperties:Array = [
				ColumnMetadata.DATA_TYPE, ColumnMetadata.MIN, ColumnMetadata.MAX,
				'dataTable', 'name', 'year', 'sqlParams'
			]; // use only these properties for querying
			for each (var attr:String in queryProperties)
			{
				var value:String = leafNode.attribute(attr);
				if (value != '')
					params[attr] = value;
			}
			if (params[ColumnMetadata.DATA_TYPE] != DataTypes.GEOMETRY)
				delete params[ColumnMetadata.DATA_TYPE];
			
			var columnRequestToken:ColumnRequestToken = new ColumnRequestToken(pathInHierarchy, proxyColumn);
			var query:AsyncToken = dataService.getColumnFromMetadata(params);
			addAsyncResponder(query, handleGetAttributeColumn, handleGetAttributeColumnFault, columnRequestToken);
			WeaveAPI.SessionManager.assignBusyTask(query, proxyColumn);
		}

					query = dataService.getEntityIdsByMetadata({"dataTable": dataTableName}, EntityType.COLUMN);
				}
				addAsyncResponder(query, handleColumnIds, handleFault, subtreeNode);
				function handleColumnIds(event:ResultEvent, subtreeNode:XML):void
				{
					var ids:Array = event.result as Array;
					var query:AsyncToken = dataService.getEntitiesById(ids);
					addAsyncResponder(query, handleColumnEntities, handleFault, [subtreeNode, ids]);
				}
			}
		}
