//TODO remove this after testing.
if (dbColl == null)
dbColl = getCollection(qi.getEntityClass());
if (qi.getSortObject() != null && qi.getSortObject().keySet() != null && !qi.getSortObject().keySet().isEmpty())
throw new QueryException("sorting is not allowed for updates.");
if (qi.getOffset() > 0)
throw new QueryException("a query offset is not allowed for updates.");
if (qi.getLimit() > 0)
throw new QueryException("a query limit is not allowed for updates.");
DBObject q = qi.getQueryObject();
if (q == null)
q = new BasicDBObject();