public void run() {
			logger.debug(xmlDocument.basequery);
			@SuppressWarnings("unchecked")
			List<Object> result = session
					.openSession()
					.createSQLQuery(
							xmlDocument.basequery + " limit " + limit
									+ " offset " + offset).list();

			Iterator<Object> iterBaseQuery = result.iterator();

			ArrayList<String> fields;
			try {
				fields = getFields(xmlDocument.basequery);
			} catch (Exception e2) {
				return;
			}

			HashMap<String, ArrayList<String>> fieldsOfListMap = new HashMap<String, ArrayList<String>>();

			while (iterBaseQuery.hasNext()) {
				Object[] item = (Object[]) iterBaseQuery.next();

				BasicDocument mongoDoc = null;
				try {
					mongoDoc = populateDocument(item, fields);
				} catch (Exception e1) {
					continue;
				}

				if (xmlDocument.getLists() != null) {

					for (Listing list : xmlDocument.getLists()) {

						if (list.query == null) {
							logger.warn("could not find sql query for listing "
									+ list.name);
							continue;
						}

						String sql = generateSqlQuery(list.query, mongoDoc,
								xmlDocument);

						try {

							// get the list from the query only once
							ArrayList<String> fieldsOfList = null;
							if (!fieldsOfListMap.containsKey(list.name)) {
								fieldsOfList = getFields(sql);
								fieldsOfListMap.put(list.name, fieldsOfList);
							} else {
								fieldsOfList = fieldsOfListMap.get(list.name);
							}

							ArrayList<BasicDocument> listDocs = new ArrayList<BasicDocument>();
							@SuppressWarnings("unchecked")
							List<Object> resultListQuery = session
									.openSession().createSQLQuery(sql).list();
							Iterator<Object> iterListQuery = resultListQuery
									.iterator();

							logger.debug(sql);
							while (iterListQuery.hasNext()) {
								Object[] listItems = (Object[]) iterListQuery
										.next();

								BasicDocument documentOfList = populateDocument(
										listItems, fieldsOfList);

								// add that document to the list
								listDocs.add(documentOfList);
							}

							// add that list to the base document
							mongoDoc.put(list.name, listDocs);

						} catch (Exception e) {
							logger.error(e.getMessage());
						}

					}
				} else {
					logger.debug("no listings found for " + xmlDocument.name);
				}

				destination.insert(mongoDoc, xmlDocument.name);
			}

		}