diff --git a/typo3/sysext/core/Migrations/Code/LegacyClassesForIde.php b/typo3/sysext/core/Migrations/Code/LegacyClassesForIde.php
index a3f5ad116114be50437e808fa2c23377351eaabe..70df36d29ae4d2dbfb4857d2fc9bebff48100faf 100644
--- a/typo3/sysext/core/Migrations/Code/LegacyClassesForIde.php
+++ b/typo3/sysext/core/Migrations/Code/LegacyClassesForIde.php
@@ -2281,11 +2281,6 @@ class Tx_Extbase_Persistence_QOM_Comparison extends \TYPO3\CMS\Extbase\Persisten
  */
 interface Tx_Extbase_Persistence_QOM_ComparisonInterface extends \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ComparisonInterface {}
 
-/**
- * @deprecated since 6.0 will be removed in 7.0
- */
-class Tx_Extbase_Persistence_QOM_Constraint extends \TYPO3\CMS\Extbase\Persistence\Generic\Qom\Constraint {}
-
 /**
  * @deprecated since 6.0 will be removed in 7.0
  */
diff --git a/typo3/sysext/extbase/Classes/DomainObject/AbstractDomainObject.php b/typo3/sysext/extbase/Classes/DomainObject/AbstractDomainObject.php
index f32d5c88db5818ca88039d4ea45ed120238c4f97..7b9337ab3f0847e3f2391715a11f352c17ecdcdf 100644
--- a/typo3/sysext/extbase/Classes/DomainObject/AbstractDomainObject.php
+++ b/typo3/sysext/extbase/Classes/DomainObject/AbstractDomainObject.php
@@ -243,7 +243,7 @@ abstract class AbstractDomainObject implements \TYPO3\CMS\Extbase\DomainObject\D
 	 * Returns the clean value of the given property. The returned value will be NULL if the clean state was not memorized before, or
 	 * if the clean value is NULL.
 	 *
-	 * @param string $propertyName The name of the property to be memorized. If omittet all persistable properties are memorized.
+	 * @param string $propertyName The name of the property to be memorized.
 	 * @return mixed The clean property value or NULL
 	 */
 	public function _getCleanProperty($propertyName) {
diff --git a/typo3/sysext/extbase/Classes/DomainObject/DomainObjectInterface.php b/typo3/sysext/extbase/Classes/DomainObject/DomainObjectInterface.php
index 11be259305f48842fcb2bcd98d350113b3936640..f9e18b5b626e76d6d47a3b330172dc2658d9f3f2 100644
--- a/typo3/sysext/extbase/Classes/DomainObject/DomainObjectInterface.php
+++ b/typo3/sysext/extbase/Classes/DomainObject/DomainObjectInterface.php
@@ -89,4 +89,31 @@ interface DomainObjectInterface {
 	 * @return array The properties
 	 */
 	public function _getProperties();
+
+	/**
+	 * Returns the clean value of the given property. The returned value will be NULL if the clean state was not memorized before, or
+	 * if the clean value is NULL.
+	 *
+	 * @param string $propertyName The name of the property to be memorized.
+	 * @return mixed The clean property value or NULL
+	 */
+	public function _getCleanProperty($propertyName);
+
+	/**
+	 * Returns TRUE if the properties were modified after reconstitution
+	 *
+	 * @param string $propertyName An optional name of a property to be checked if its value is dirty
+	 * @throws \TYPO3\CMS\Extbase\Persistence\Generic\Exception\TooDirtyException
+	 * @return boolean
+	 */
+	public function _isDirty($propertyName = NULL);
+
+	/**
+	 * Register an object's clean state, e.g. after it has been reconstituted
+	 * from the database.
+	 *
+	 * @param string $propertyName The name of the property to be memorized. If omitted all persistable properties are memorized.
+	 * @return void
+	 */
+	public function _memorizeCleanState($propertyName = NULL);
 }
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php
index 00ce33c5b91c13e6dd36be3e0db41d7f391cbbf7..db5e2391c23bbe04684a39e43b8bddbf264b82fd 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php
@@ -28,6 +28,8 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
+use TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface;
+
 /**
  * A persistence backend. This backend maps objects to the relational model of the storage backend.
  * It persists all added, removed and changed objects.
@@ -111,7 +113,6 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
 	 * Constructs the backend
 	 *
 	 * @param \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager
-	 * @return void
 	 */
 	public function __construct(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager) {
 		$this->configurationManager = $configurationManager;
@@ -316,6 +317,7 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
 	protected function persistObjects() {
 		$this->visitedDuringPersistence = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
 		foreach ($this->aggregateRootObjects as $object) {
+			/** @var DomainObjectInterface $object */
 			if ($object->_isNew()) {
 				$this->insertObject($object);
 			}
@@ -426,6 +428,7 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
 		$updateSortingOfFollowing = FALSE;
 
 		foreach ($objectStorage as $object) {
+			/** @var DomainObjectInterface $object */
 			if (empty($currentUids)) {
 				$sortingPosition = 1;
 			} else {
@@ -507,7 +510,7 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
 	 * Updates the fields defining the relation between the object and the parent object.
 	 *
 	 * @param \TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface $object
-	 * @param \TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface $parentObject
+	 * @param \TYPO3\CMS\Extbase\DomainObject\AbstractEntity $parentObject
 	 * @param string $parentPropertyName
 	 * @param integer $sortingPosition
 	 * @return void
@@ -1015,5 +1018,6 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
 		} else {
 			return $input;
 		}
+		return NULL;
 	}
 }
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/BackendInterface.php b/typo3/sysext/extbase/Classes/Persistence/Generic/BackendInterface.php
index b45fd331b3ff824744426017485561c3adb8bbd6..f8d0dcfc2fa407e17a5a917cbc98a2373749c963 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/BackendInterface.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/BackendInterface.php
@@ -101,4 +101,21 @@ interface BackendInterface {
 	 */
 	public function isNewObject($object);
 
+	/**
+	 * Returns the number of records matching the query.
+	 *
+	 * @param \TYPO3\CMS\Extbase\Persistence\QueryInterface $query
+	 * @return integer
+	 * @api
+	 */
+	public function getObjectCountByQuery(\TYPO3\CMS\Extbase\Persistence\QueryInterface $query);
+
+	/**
+	 * Returns the object data matching the $query.
+	 *
+	 * @param \TYPO3\CMS\Extbase\Persistence\QueryInterface $query
+	 * @return array
+	 * @api
+	 */
+	public function getObjectDataByQuery(\TYPO3\CMS\Extbase\Persistence\QueryInterface $query);
 }
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/LazyObjectStorage.php b/typo3/sysext/extbase/Classes/Persistence/Generic/LazyObjectStorage.php
index f5d625852f4c9387ffc9e38be912cd6b9906f88d..1c14f2919011c6866c253908f7b8c27ac2c299ea 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/LazyObjectStorage.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/LazyObjectStorage.php
@@ -166,7 +166,7 @@ class LazyObjectStorage extends \TYPO3\CMS\Extbase\Persistence\ObjectStorage imp
 	public function count() {
 		$columnMap = $this->dataMapper->getDataMap(get_class($this->parentObject))->getColumnMap($this->propertyName);
 		$numberOfElements = NULL;
-		if (!$this->isInitialized && $columnMap->getTypeOfRelation() === \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap::RELATION_HAS_MANY) {
+		if (!$this->isInitialized && $columnMap->getTypeOfRelation() === Mapper\ColumnMap::RELATION_HAS_MANY) {
 			$numberOfElements = $this->dataMapper->countRelated($this->parentObject, $this->propertyName, $this->fieldValue);
 		} else {
 			$this->initialize();
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMap.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMap.php
index 56e3145df75f9836636ee2864701559e9e84f2a3..3fd5f5a5f0248c53acef329cac890f872ef2df3c 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMap.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMap.php
@@ -234,7 +234,7 @@ class DataMap {
 	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap $columnMap The column map
 	 * @return void
 	 */
-	public function addColumnMap(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap $columnMap) {
+	public function addColumnMap(ColumnMap $columnMap) {
 		$this->columnMaps[$columnMap->getPropertyName()] = $columnMap;
 	}
 
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapFactory.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapFactory.php
index 443de0f0d9bb2971a5f0f62d03e1938bce0ba523..625420b1b837efd834cfee1b6d0bf1da509142c6 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapFactory.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapFactory.php
@@ -27,7 +27,6 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Mapper;
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
-use TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap;
 
 /**
  * A factory for a data map to map a single table configured in $TCA on a domain object.
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php
index 0e431309eb753a06ccfb6cbbd17f50ae30ff4b5a..c663d9e1b55fd2e0ae55b65c607841fd62df0224 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php
@@ -27,7 +27,7 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Mapper;
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
-use TYPO3\CMS\Core\Type\TypeInterface;
+
 use TYPO3\CMS\Extbase\Utility\TypeHandlingUtility;
 
 /**
@@ -473,6 +473,7 @@ class DataMapper implements \TYPO3\CMS\Core\SingletonInterface {
 	 * @return mixed
 	 */
 	public function mapResultToPropertyValue(\TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface $parentObject, $propertyName, $result) {
+		$propertyValue = NULL;
 		if ($result instanceof \TYPO3\CMS\Extbase\Persistence\Generic\LoadingStrategyInterface) {
 			$propertyValue = $result;
 		} else {
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/PersistenceManager.php b/typo3/sysext/extbase/Classes/Persistence/Generic/PersistenceManager.php
index 2a7075d98c1bbd4e4de3d434ac0cf3809b7726e4..b6ae31cdf6de87b8a85b64461afb1f0251e3dd0d 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/PersistenceManager.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/PersistenceManager.php
@@ -27,6 +27,9 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic;
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
+use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
+use TYPO3\CMS\Extbase\Persistence\QueryInterface;
+
 /**
  * The Extbase Persistence Manager
  *
@@ -40,17 +43,17 @@ class PersistenceManager implements \TYPO3\CMS\Extbase\Persistence\PersistenceMa
 	protected $newObjects = array();
 
 	/**
-	 * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage
+	 * @var ObjectStorage
 	 */
 	protected $changedObjects;
 
 	/**
-	 * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage
+	 * @var ObjectStorage
 	 */
 	protected $addedObjects;
 
 	/**
-	 * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage
+	 * @var ObjectStorage
 	 */
 	protected $removedObjects;
 
@@ -76,9 +79,9 @@ class PersistenceManager implements \TYPO3\CMS\Extbase\Persistence\PersistenceMa
 	 * Create new instance
 	 */
 	public function __construct() {
-		$this->addedObjects = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
-		$this->removedObjects = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
-		$this->changedObjects = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
+		$this->addedObjects = new ObjectStorage();
+		$this->removedObjects = new ObjectStorage();
+		$this->changedObjects = new ObjectStorage();
 	}
 
 	/**
@@ -94,22 +97,22 @@ class PersistenceManager implements \TYPO3\CMS\Extbase\Persistence\PersistenceMa
 	/**
 	 * Returns the number of records matching the query.
 	 *
-	 * @param \TYPO3\CMS\Extbase\Persistence\QueryInterface $query
+	 * @param QueryInterface $query
 	 * @return integer
 	 * @api
 	 */
-	public function getObjectCountByQuery(\TYPO3\CMS\Extbase\Persistence\QueryInterface $query) {
+	public function getObjectCountByQuery(QueryInterface $query) {
 		return $this->backend->getObjectCountByQuery($query);
 	}
 
 	/**
 	 * Returns the object data matching the $query.
 	 *
-	 * @param \TYPO3\CMS\Extbase\Persistence\QueryInterface $query
+	 * @param QueryInterface $query
 	 * @return array
 	 * @api
 	 */
-	public function getObjectDataByQuery(\TYPO3\CMS\Extbase\Persistence\QueryInterface $query) {
+	public function getObjectDataByQuery(QueryInterface $query) {
 		return $this->backend->getObjectDataByQuery($query);
 	}
 
@@ -167,16 +170,16 @@ class PersistenceManager implements \TYPO3\CMS\Extbase\Persistence\PersistenceMa
 		$this->backend->setDeletedEntities($this->removedObjects);
 		$this->backend->commit();
 
-		$this->addedObjects = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
-		$this->removedObjects = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
-		$this->changedObjects = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
+		$this->addedObjects = new ObjectStorage();
+		$this->removedObjects = new ObjectStorage();
+		$this->changedObjects = new ObjectStorage();
 	}
 
 	/**
 	 * Return a query object for the given type.
 	 *
 	 * @param string $type
-	 * @return \TYPO3\CMS\Extbase\Persistence\QueryInterface
+	 * @return QueryInterface
 	 */
 	public function createQueryForType($type) {
 		return $this->queryFactory->create($type);
@@ -256,9 +259,9 @@ class PersistenceManager implements \TYPO3\CMS\Extbase\Persistence\PersistenceMa
 	 */
 	public function clearState() {
 		$this->newObjects = array();
-		$this->addedObjects = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
-		$this->removedObjects = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
-		$this->changedObjects = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
+		$this->addedObjects = new ObjectStorage();
+		$this->removedObjects = new ObjectStorage();
+		$this->changedObjects = new ObjectStorage();
 		$this->persistenceSession->destroy();
 	}
 
@@ -295,6 +298,7 @@ class PersistenceManager implements \TYPO3\CMS\Extbase\Persistence\PersistenceMa
 	 *
 	 * @throws \TYPO3\CMS\Extbase\Persistence\Generic\Exception\NotImplementedException
 	 * @param object $object The object to be converted
+	 * @return array
 	 * @api
 	 */
 	public function convertObjectToIdentityArray($object) {
@@ -307,6 +311,7 @@ class PersistenceManager implements \TYPO3\CMS\Extbase\Persistence\PersistenceMa
 	 *
 	 * @throws \TYPO3\CMS\Extbase\Persistence\Generic\Exception\NotImplementedException
 	 * @param array $array The array to be iterated over
+	 * @return array
 	 * @api
 	 * @see convertObjectToIdentityArray()
 	 */
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/PropertyType.php b/typo3/sysext/extbase/Classes/Persistence/Generic/PropertyType.php
index 73b2a7781d6e09d670b66a5596c746080c74f667..f1db9f5b1c51630d585d984dff09976511276e0e 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/PropertyType.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/PropertyType.php
@@ -215,8 +215,6 @@ class PropertyType {
 
 	/**
 	 * Make instantiation impossible...
-	 *
-	 * @return void
 	 */
 	private function __construct() {
 	}
@@ -354,8 +352,6 @@ class PropertyType {
 			case 'double':
 				$value = \TYPO3\CMS\Extbase\Persistence\Generic\PropertyType::DOUBLE;
 				break;
-			case 'integer':
-
 			case 'int':
 				$value = \TYPO3\CMS\Extbase\Persistence\Generic\PropertyType::INTEGER;
 				break;
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/BindVariableValue.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/BindVariableValue.php
index 3e1ef6b445666304bf20ef9febd1366fefe7d1a6..616f71af7e6af898aefd4c97748ae41278fab069 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/BindVariableValue.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/BindVariableValue.php
@@ -30,7 +30,7 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
 /**
  * Evaluates to the value of a bind variable.
  */
-class BindVariableValue extends \TYPO3\CMS\Extbase\Persistence\Generic\Qom\StaticOperand implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\BindVariableValueInterface {
+class BindVariableValue implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\BindVariableValueInterface {
 
 	/**
 	 * @var string
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/Comparison.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/Comparison.php
index 0ffa58724b6362990a280e161302cb104ecc50ff..21c5b3a5d7617e4c4dfad71f51008617965d6e83 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/Comparison.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/Comparison.php
@@ -27,6 +27,8 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
+use TYPO3\CMS\Extbase\Persistence\QueryInterface;
+
 /**
  * Filters node-tuples based on the outcome of a binary operation.
  *
@@ -70,10 +72,10 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
  * the string "\x" matches the character "x", and
  * all other characters match themselves.
  */
-class Comparison implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ComparisonInterface {
+class Comparison implements ComparisonInterface {
 
 	/**
-	 * @var \TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface
+	 * @var PropertyValueInterface
 	 */
 	protected $operand1;
 
@@ -87,7 +89,7 @@ class Comparison implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\Compariso
 	 */
 	protected $operand2;
 
-	/*
+	/**
 	 * @var string
 	 */
 	protected $parameterIdentifier;
@@ -95,11 +97,11 @@ class Comparison implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\Compariso
 	/**
 	 * Constructs this Comparison instance
 	 *
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface $operand1
-	 * @param integer $operator one of \TYPO3\CMS\Extbase\Persistence\QueryInterface.OPERATOR_*
+	 * @param PropertyValueInterface $operand1
+	 * @param integer $operator one of QueryInterface::OPERATOR_*
 	 * @param mixed $operand2
 	 */
-	public function __construct(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface $operand1, $operator, $operand2) {
+	public function __construct(PropertyValueInterface $operand1, $operator, $operand2) {
 		$this->operand1 = $operand1;
 		$this->operator = $operator;
 		$this->operand2 = $operand2;
@@ -108,7 +110,7 @@ class Comparison implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\Compariso
 	/**
 	 * Gets the first operand.
 	 *
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface the operand; non-null
+	 * @return PropertyValueInterface the operand; non-null
 	 */
 	public function getOperand1() {
 		return $this->operand1;
@@ -117,16 +119,16 @@ class Comparison implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\Compariso
 	/**
 	 * Gets the operator.
 	 *
-	 * @return string one of \TYPO3\CMS\Extbase\Persistence\QueryInterface.OPERATOR_*
+	 * @return string One of QueryInterface::OPERATOR_*
 	 */
 	public function getOperator() {
 		$operator = $this->operator;
 
 		if ($this->getOperand2() === NULL) {
-			if ($operator === \TYPO3\CMS\Extbase\Persistence\QueryInterface::OPERATOR_EQUAL_TO) {
-				$operator = \TYPO3\CMS\Extbase\Persistence\QueryInterface::OPERATOR_EQUAL_TO_NULL;
-			} elseif ($operator === \TYPO3\CMS\Extbase\Persistence\QueryInterface::OPERATOR_NOT_EQUAL_TO) {
-				$operator = \TYPO3\CMS\Extbase\Persistence\QueryInterface::OPERATOR_NOT_EQUAL_TO_NULL;
+			if ($operator === QueryInterface::OPERATOR_EQUAL_TO) {
+				$operator = QueryInterface::OPERATOR_EQUAL_TO_NULL;
+			} elseif ($operator === QueryInterface::OPERATOR_NOT_EQUAL_TO) {
+				$operator = QueryInterface::OPERATOR_NOT_EQUAL_TO_NULL;
 			}
 		}
 
@@ -156,4 +158,13 @@ class Comparison implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\Compariso
 	public function getParameterIdentifier() {
 		return $this->parameterIdentifier;
 	}
+
+	/**
+	 * Fills an array with the names of all bound variables in the constraints
+	 *
+	 * @param array &$boundVariables
+	 * @return void
+	 */
+	public function collectBoundVariableNames(&$boundVariables) {
+	}
 }
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/ComparisonInterface.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/ComparisonInterface.php
index 41488d17eeac760832e8780e6d56e06173f508e3..ee3b68dc59bfb615c722002617bfecbc8d8738a4 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/ComparisonInterface.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/ComparisonInterface.php
@@ -72,26 +72,37 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-interface ComparisonInterface extends \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface {
+interface ComparisonInterface extends ConstraintInterface {
 
 	/**
 	 * Gets the first operand.
 	 *
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface the operand; non-null
+	 * @return PropertyValueInterface the operand; non-null
 	 */
 	public function getOperand1();
 
 	/**
 	 * Gets the operator.
 	 *
-	 * @return string one of \TYPO3\CMS\Extbase\Persistence\QueryObjectModelConstantsInterface.OPERATOR_*
+	 * @return string one of \TYPO3\CMS\Extbase\Persistence\QueryInterface::*
 	 */
 	public function getOperator();
 
 	/**
 	 * Gets the second operand.
 	 *
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\StaticOperandInterface the operand; non-null
+	 * @return StaticOperandInterface the operand; non-null
 	 */
 	public function getOperand2();
+
+	/**
+	 * @param string $parameterIdentifier
+	 * @return void
+	 */
+	public function setParameterIdentifier($parameterIdentifier);
+
+	/**
+	 * @return string
+	 */
+	public function getParameterIdentifier();
 }
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/Constraint.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/Constraint.php
deleted file mode 100644
index 2cbe45b3bfe86e7727b857c82f7641efab371a89..0000000000000000000000000000000000000000
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/Constraint.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2010-2013 Extbase Team (http://forge.typo3.org/projects/typo3v4-mvc)
- *  Extbase is a backport of TYPO3 Flow. All credits go to the TYPO3 Flow team.
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the text file GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Base class for constraints in the QOM.
- *
- * @api
- */
-class Constraint implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface {
-
-}
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/ConstraintInterface.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/ConstraintInterface.php
index 93545738ed63ab6b6945399f9d4fac565d4763db..ca25eab55c16c2b0d0e0acd729bd2402a1793a72 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/ConstraintInterface.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/ConstraintInterface.php
@@ -35,4 +35,11 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
  */
 interface ConstraintInterface {
 
+	/**
+	 * Fills an array with the names of all bound variables in the constraints
+	 *
+	 * @param array &$boundVariables
+	 * @return void
+	 */
+	public function collectBoundVariableNames(&$boundVariables);
 }
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/DynamicOperand.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/DynamicOperand.php
deleted file mode 100644
index 0a22d84cbdeb2f96a72469407027b190b644317b..0000000000000000000000000000000000000000
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/DynamicOperand.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2010-2013 Extbase Team (http://forge.typo3.org/projects/typo3v4-mvc)
- *  Extbase is a backport of TYPO3 Flow. All credits go to the TYPO3 Flow team.
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the text file GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * An operand whose value can only be determined in evaluating the query.
- */
-class DynamicOperand extends \TYPO3\CMS\Extbase\Persistence\Generic\Qom\Operand implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface {
-
-}
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/DynamicOperandInterface.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/DynamicOperandInterface.php
index de64a5f3d98f32419608a8fa1af76c3b4b465b05..9b5bdfe06d5a8e56fc75bc88c7379264a1831cc8 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/DynamicOperandInterface.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/DynamicOperandInterface.php
@@ -30,6 +30,6 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
 /**
  * An operand whose value can only be determined in evaluating the query.
  */
-interface DynamicOperandInterface extends \TYPO3\CMS\Extbase\Persistence\Generic\Qom\OperandInterface {
+interface DynamicOperandInterface extends OperandInterface {
 
 }
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/EquiJoinCondition.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/EquiJoinCondition.php
index 5b3ec66e5f9787e6177f3f6f1e6f47c450d7fbcf..0cff933ddb9d7d052de847826f682b6399125e7d 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/EquiJoinCondition.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/EquiJoinCondition.php
@@ -34,7 +34,7 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
  * the selector2Name node has a property named property2Name, and
  * the value of property property1Name is equal to the value of property property2Name.
  */
-class EquiJoinCondition implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\JoinConditionInterface {
+class EquiJoinCondition implements EquiJoinConditionInterface {
 
 	/**
 	 * @var string
@@ -107,4 +107,22 @@ class EquiJoinCondition implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\Jo
 	public function getProperty2Name() {
 		return $this->property2Name;
 	}
+
+	/**
+	 * Gets the name of the child selector.
+	 *
+	 * @return string the selector name; non-null
+	 */
+	public function getChildSelectorName() {
+		return '';
+	}
+
+	/**
+	 * Gets the name of the parent selector.
+	 *
+	 * @return string the selector name; non-null
+	 */
+	public function getParentSelectorName() {
+		return '';
+	}
 }
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/EquiJoinConditionInterface.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/EquiJoinConditionInterface.php
index 92c775f05da44c80b7360e5afcd6ffa074401148..1d37b3db5bbca64e14684952f47a35ebf2c1e1da 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/EquiJoinConditionInterface.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/EquiJoinConditionInterface.php
@@ -34,7 +34,7 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
  * would return true, where childSelectorNode is the node for childSelector and
  * parentSelectorNode is the node for parentSelector.
  */
-interface EquiJoinConditionInterface extends \TYPO3\CMS\Extbase\Persistence\Generic\Qom\JoinConditionInterface {
+interface EquiJoinConditionInterface extends JoinConditionInterface {
 
 	/**
 	 * Gets the name of the child selector.
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/Join.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/Join.php
index 28bb4ecc3b15660d7141abfd8f6349b112efffa0..95f971a32f961e39f1cd304998c0b4550b1be845 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/Join.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/Join.php
@@ -30,15 +30,15 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
 /**
  * Performs a join between two node-tuple sources.
  */
-class Join implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\JoinInterface {
+class Join implements JoinInterface {
 
 	/**
-	 * @var \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface
+	 * @var SourceInterface
 	 */
 	protected $left;
 
 	/**
-	 * @var \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface
+	 * @var SourceInterface
 	 */
 	protected $right;
 
@@ -48,19 +48,19 @@ class Join implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\JoinInterface {
 	protected $joinType;
 
 	/**
-	 * @var \TYPO3\CMS\Extbase\Persistence\Generic\Qom\JoinConditionInterface
+	 * @var JoinConditionInterface
 	 */
 	protected $joinCondition;
 
 	/**
 	 * Constructs the Join instance
 	 *
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface $left the left node-tuple source; non-null
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface $right the right node-tuple source; non-null
-	 * @param string $joinType one of QueryObjectModelConstants.JCR_JOIN_TYPE_*
+	 * @param SourceInterface $left the left node-tuple source; non-null
+	 * @param SourceInterface $right the right node-tuple source; non-null
+	 * @param string $joinType One of Query::JCR_JOIN_TYPE_*
 	 * @param JoinConditionInterface $joinCondition
 	 */
-	public function __construct(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface $left, \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface $right, $joinType, \TYPO3\CMS\Extbase\Persistence\Generic\Qom\JoinConditionInterface $joinCondition) {
+	public function __construct(SourceInterface $left, SourceInterface $right, $joinType, JoinConditionInterface $joinCondition) {
 		$this->left = $left;
 		$this->right = $right;
 		$this->joinType = $joinType;
@@ -70,7 +70,7 @@ class Join implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\JoinInterface {
 	/**
 	 * Gets the left node-tuple source.
 	 *
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface the left source; non-null
+	 * @return SourceInterface the left source; non-null
 	 */
 	public function getLeft() {
 		return $this->left;
@@ -79,7 +79,7 @@ class Join implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\JoinInterface {
 	/**
 	 * Gets the right node-tuple source.
 	 *
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface the right source; non-null
+	 * @return SourceInterface the right source; non-null
 	 */
 	public function getRight() {
 		return $this->right;
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/JoinConditionInterface.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/JoinConditionInterface.php
index c470c0d7fce5c0a087f345408fc4f56dbea686f0..b9082c43bc386e454d3cd149173a155e1a7d9b20 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/JoinConditionInterface.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/JoinConditionInterface.php
@@ -32,4 +32,10 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
  */
 interface JoinConditionInterface {
 
+	/**
+	 * Gets the name of the first selector.
+	 *
+	 * @return string the selector name; non-null
+	 */
+	public function getSelector1Name();
 }
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/JoinInterface.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/JoinInterface.php
index 69990d19a9b8d269420f79a369dd11100b22885a..0eeedbc51c25b53cdb8a318924777ecc253c7f43 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/JoinInterface.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/JoinInterface.php
@@ -30,19 +30,19 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
 /**
  * Performs a join between two node-tuple sources.
  */
-interface JoinInterface extends \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface {
+interface JoinInterface extends SourceInterface {
 
 	/**
 	 * Gets the left node-tuple source.
 	 *
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface the left source; non-null
+	 * @return SelectorInterface the left source; non-null
 	 */
 	public function getLeft();
 
 	/**
 	 * Gets the right node-tuple source.
 	 *
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface the right source; non-null
+	 * @return SelectorInterface the right source; non-null
 	 */
 	public function getRight();
 
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/LogicalAnd.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/LogicalAnd.php
index b0f978b749ce27a7d9693555598a4edcd3122921..eed5b910a7936d53a4a4ee005255c7a439a86812 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/LogicalAnd.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/LogicalAnd.php
@@ -33,23 +33,23 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
  * To satisfy the And constraint, a node-tuple must satisfy both constraint1 and
  * constraint2.
  */
-class LogicalAnd implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\AndInterface {
+class LogicalAnd implements AndInterface {
 
 	/**
-	 * @var \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface
+	 * @var ConstraintInterface
 	 */
 	protected $constraint1;
 
 	/**
-	 * @var \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface
+	 * @var ConstraintInterface
 	 */
 	protected $constraint2;
 
 	/**
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint1
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint2
+	 * @param ConstraintInterface $constraint1
+	 * @param ConstraintInterface $constraint2
 	 */
-	public function __construct(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint1, \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint2) {
+	public function __construct(ConstraintInterface $constraint1, ConstraintInterface $constraint2) {
 		$this->constraint1 = $constraint1;
 		$this->constraint2 = $constraint2;
 	}
@@ -68,7 +68,7 @@ class LogicalAnd implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\AndInterf
 	/**
 	 * Gets the first constraint.
 	 *
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface the constraint; non-null
+	 * @return ConstraintInterface the constraint; non-null
 	 */
 	public function getConstraint1() {
 		return $this->constraint1;
@@ -77,7 +77,7 @@ class LogicalAnd implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\AndInterf
 	/**
 	 * Gets the second constraint.
 	 *
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface the constraint; non-null
+	 * @return ConstraintInterface the constraint; non-null
 	 */
 	public function getConstraint2() {
 		return $this->constraint2;
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/LogicalNot.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/LogicalNot.php
index 3431903390e2a58eca0d96ca470ad19d372d98d5..fc46c5c0acd4c08c48503f893804a077ca563620 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/LogicalNot.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/LogicalNot.php
@@ -32,17 +32,17 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
  *
  * To satisfy the Not constraint, the node-tuple must not satisfy constraint.
  */
-class LogicalNot implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\NotInterface {
+class LogicalNot implements NotInterface {
 
 	/**
-	 * @var \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface
+	 * @var ConstraintInterface
 	 */
 	protected $constraint;
 
 	/**
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint
+	 * @param ConstraintInterface $constraint
 	 */
-	public function __construct(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint) {
+	public function __construct(ConstraintInterface $constraint) {
 		$this->constraint = $constraint;
 	}
 
@@ -59,7 +59,7 @@ class LogicalNot implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\NotInterf
 	/**
 	 * Gets the constraint negated by this Not constraint.
 	 *
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface the constraint; non-null
+	 * @return ConstraintInterface the constraint; non-null
 	 */
 	public function getConstraint() {
 		return $this->constraint;
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/LogicalOr.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/LogicalOr.php
index 133cc6d8db90bb68f943ffb179cd6234cc111280..4d0ec198c93f3601e9de798917c3315870618c94 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/LogicalOr.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/LogicalOr.php
@@ -35,23 +35,23 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
  * satisfy constraint2 but not constraint1, or
  * satisfy both constraint1 and constraint2.
  */
-class LogicalOr implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\OrInterface {
+class LogicalOr implements OrInterface {
 
 	/**
-	 * @var \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface
+	 * @var ConstraintInterface
 	 */
 	protected $constraint1;
 
 	/**
-	 * @var \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface
+	 * @var ConstraintInterface
 	 */
 	protected $constraint2;
 
 	/**
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint1
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint2
+	 * @param ConstraintInterface $constraint1
+	 * @param ConstraintInterface $constraint2
 	 */
-	public function __construct(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint1, \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint2) {
+	public function __construct(ConstraintInterface $constraint1, ConstraintInterface $constraint2) {
 		$this->constraint1 = $constraint1;
 		$this->constraint2 = $constraint2;
 	}
@@ -70,7 +70,7 @@ class LogicalOr implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\OrInterfac
 	/**
 	 * Gets the first constraint.
 	 *
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface the constraint; non-null
+	 * @return ConstraintInterface the constraint; non-null
 	 */
 	public function getConstraint1() {
 		return $this->constraint1;
@@ -79,7 +79,7 @@ class LogicalOr implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\OrInterfac
 	/**
 	 * Gets the second constraint.
 	 *
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface the constraint; non-null
+	 * @return ConstraintInterface the constraint; non-null
 	 */
 	public function getConstraint2() {
 		return $this->constraint2;
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/LowerCase.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/LowerCase.php
index cf2a3dc2de4651ea54b34fe48d656eae85493bbf..a2384fd56230a1a54d1782a3742fd07ea3398645 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/LowerCase.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/LowerCase.php
@@ -36,10 +36,10 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
  *
  * If operand evaluates to null, the LowerCase operand also evaluates to null.
  */
-class LowerCase implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\LowerCaseInterface {
+class LowerCase implements LowerCaseInterface {
 
 	/**
-	 * @var \TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface
+	 * @var DynamicOperandInterface
 	 */
 	protected $operand;
 
@@ -48,14 +48,14 @@ class LowerCase implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\LowerCaseI
 	 *
 	 * @param DynamicOperandInterface $operand
 	 */
-	public function __construct(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface $operand) {
+	public function __construct(DynamicOperandInterface $operand) {
 		$this->operand = $operand;
 	}
 
 	/**
 	 * Gets the operand whose value is converted to a lower-case string.
 	 *
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface the operand; non-null
+	 * @return DynamicOperandInterface the operand; non-null
 	 */
 	public function getOperand() {
 		return $this->operand;
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/LowerCaseInterface.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/LowerCaseInterface.php
index 0cf0e7ab9cd25052ed5cfed6b35846c5ad5ec58d..fdd9e8634fce7a119b60774e117107994f6c1171 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/LowerCaseInterface.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/LowerCaseInterface.php
@@ -36,12 +36,12 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
  *
  * If operand evaluates to null, the LowerCase operand also evaluates to null.
  */
-interface LowerCaseInterface extends \TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface {
+interface LowerCaseInterface extends DynamicOperandInterface {
 
 	/**
 	 * Gets the operand whose value is converted to a lower-case string.
 	 *
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface the operand; non-null
+	 * @return DynamicOperandInterface the operand; non-null
 	 */
 	public function getOperand();
 }
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/NotInterface.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/NotInterface.php
index f75265dba6e2280d6c8d15cd9fecb04be7bdfa73..388f616cd00773b93f40633bd822a6b17c8ca077 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/NotInterface.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/NotInterface.php
@@ -32,12 +32,12 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
  *
  * To satisfy the Not constraint, the node-tuple must not satisfy constraint.
  */
-interface NotInterface extends \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface {
+interface NotInterface extends ConstraintInterface {
 
 	/**
 	 * Gets the constraint negated by this Not constraint.
 	 *
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface the constraint; non-null
+	 * @return ConstraintInterface the constraint; non-null
 	 */
 	public function getConstraint();
 }
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/Operand.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/Operand.php
deleted file mode 100644
index 6c70dbe58edbfb8a2deb875756d1ece082edb903..0000000000000000000000000000000000000000
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/Operand.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2010-2013 Extbase Team (http://forge.typo3.org/projects/typo3v4-mvc)
- *  Extbase is a backport of TYPO3 Flow. All credits go to the TYPO3 Flow team.
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the text file GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * An operand to a binary operation specified by a Comparison.
- */
-class Operand implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\OperandInterface {
-
-}
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/OrInterface.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/OrInterface.php
index 1ea6ea3d1529f2bfdfbabbb3a65c0b327a9a145a..9894e95ba0782e0beae53bcd3a2f57c5135e1b3e 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/OrInterface.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/OrInterface.php
@@ -35,19 +35,19 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
  * satisfy constraint2 but not constraint1, or
  * satisfy both constraint1 and constraint2.
  */
-interface OrInterface extends \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface {
+interface OrInterface extends ConstraintInterface {
 
 	/**
 	 * Gets the first constraint.
 	 *
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface the constraint; non-null
+	 * @return ConstraintInterface the constraint; non-null
 	 */
 	public function getConstraint1();
 
 	/**
 	 * Gets the second constraint.
 	 *
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface the constraint; non-null
+	 * @return ConstraintInterface the constraint; non-null
 	 */
 	public function getConstraint2();
 }
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/Ordering.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/Ordering.php
index 1da2626271409ef941d1e7a71719417cb656fb6f..6f5c7897a0757f55ad4fbd2ee281a3ba83d58e6c 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/Ordering.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/Ordering.php
@@ -31,25 +31,25 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
  * Determines the relative order of two rows in the result set by evaluating operand for
  * each.
  */
-class Ordering implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\OrderingInterface {
+class Ordering implements OrderingInterface {
 
 	/**
-	 * @var \TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface
+	 * @var DynamicOperandInterface
 	 */
 	protected $operand;
 
 	/**
-	 * @var string One of \TYPO3\CMS\Extbase\Persistence\Generic\Qom\QueryObjectModelConstantsInterface::JCR_ORDER_*
+	 * @var string One of \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_*
 	 */
 	protected $order;
 
 	/**
 	 * Constructs the Ordering instance
 	 *
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface $operand The operand; non-null
-	 * @param string $order either \TYPO3\CMS\Extbase\Persistence\Generic\Qom\QueryObjectModelConstantsInterface::JCR_ORDER_ASCENDING or \TYPO3\CMS\Extbase\Persistence\Generic\Qom\QueryObjectModelConstantsInterface::JCR_ORDER_DESCENDING
+	 * @param DynamicOperandInterface $operand The operand; non-null
+	 * @param string $order One of \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_*
 	 */
-	public function __construct(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface $operand, $order = \TYPO3\CMS\Extbase\Persistence\Generic\Qom\QueryObjectModelConstantsInterface::JCR_ORDER_ASCENDING) {
+	public function __construct(DynamicOperandInterface $operand, $order = \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING) {
 		$this->operand = $operand;
 		$this->order = $order;
 	}
@@ -57,7 +57,7 @@ class Ordering implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\OrderingInt
 	/**
 	 * The operand by which to order.
 	 *
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface the operand; non-null
+	 * @return DynamicOperandInterface the operand; non-null
 	 */
 	public function getOperand() {
 		return $this->operand;
@@ -66,7 +66,7 @@ class Ordering implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\OrderingInt
 	/**
 	 * Gets the order.
 	 *
-	 * @return string either \TYPO3\CMS\Extbase\Persistence\Generic\Qom\QueryObjectModelConstantsInterface::JCR_ORDER_ASCENDING or \TYPO3\CMS\Extbase\Persistence\Generic\Qom\QueryObjectModelConstantsInterface::JCR_ORDER_DESCENDING
+	 * @return string One of \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_*
 	 */
 	public function getOrder() {
 		return $this->order;
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/OrderingInterface.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/OrderingInterface.php
index bd8cf84e43972a6bc87ec8d6d1336631e57381c9..5ccd748a3e1b718273bc36f24a73713b2861deb6 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/OrderingInterface.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/OrderingInterface.php
@@ -36,14 +36,14 @@ interface OrderingInterface {
 	/**
 	 * The operand by which to order.
 	 *
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface the operand; non-null
+	 * @return DynamicOperandInterface the operand; non-null
 	 */
 	public function getOperand();
 
 	/**
 	 * Gets the order.
 	 *
-	 * @return string either \TYPO3\CMS\Extbase\Persistence\Generic\Qom\QueryObjectModelConstantsInterface::JCR_ORDER_ASCENDING or \TYPO3\CMS\Extbase\Persistence\Generic\Qom\QueryObjectModelConstantsInterface::JCR_ORDER_DESCENDING
+	 * @return string One of \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_*
 	 */
 	public function getOrder();
 }
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/PropertyValue.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/PropertyValue.php
index b32748e781de7c9a411e8800731d9a210a7992b7..6033466f4e8b1f2f51a13eb591720090c6ffc580 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/PropertyValue.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/PropertyValue.php
@@ -38,7 +38,7 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
  * selector is not the name of a selector in the query, or
  * property is not a syntactically valid JCR name.
  */
-class PropertyValue extends \TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperand implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\PropertyValueInterface {
+class PropertyValue implements PropertyValueInterface {
 
 	/**
 	 * @var string
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/PropertyValueInterface.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/PropertyValueInterface.php
index 4ce37646c2450fe5afdcd752697f336db0e8e64a..7f64671c932fcfd6d331826c47b4385a5110f6eb 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/PropertyValueInterface.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/PropertyValueInterface.php
@@ -38,7 +38,7 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
  * selector is not the name of a selector in the query, or
  * property is not a syntactically valid JCR name.
  */
-interface PropertyValueInterface extends \TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface {
+interface PropertyValueInterface extends DynamicOperandInterface {
 
 	/**
 	 * Gets the name of the selector against which to evaluate this operand.
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/QueryObjectModelFactory.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/QueryObjectModelFactory.php
index ccab8119b0bc36081c2dd6b1b76cca6220ba255b..033de282e0487589d6e3d38d61735c33450ed57b 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/QueryObjectModelFactory.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/QueryObjectModelFactory.php
@@ -67,13 +67,13 @@ class QueryObjectModelFactory implements \TYPO3\CMS\Core\SingletonInterface {
 	/**
 	 * Performs a join between two node-tuple sources.
 	 *
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface $left the left node-tuple source; non-null
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface $right the right node-tuple source; non-null
+	 * @param SourceInterface $left the left node-tuple source; non-null
+	 * @param SourceInterface $right the right node-tuple source; non-null
 	 * @param string $joinType one of QueryObjectModelConstants.JCR_JOIN_TYPE_*
 	 * @param JoinConditionInterface $joinCondition
 	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\JoinInterface the join; non-null
 	 */
-	public function join(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface $left, \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface $right, $joinType, \TYPO3\CMS\Extbase\Persistence\Generic\Qom\JoinConditionInterface $joinCondition) {
+	public function join(SourceInterface $left, SourceInterface $right, $joinType, JoinConditionInterface $joinCondition) {
 		return $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Qom\\Join', $left, $right, $joinType, $joinCondition);
 	}
 
@@ -94,48 +94,48 @@ class QueryObjectModelFactory implements \TYPO3\CMS\Core\SingletonInterface {
 	/**
 	 * Performs a logical conjunction of two other constraints.
 	 *
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint1 the first constraint; non-null
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint2 the second constraint; non-null
+	 * @param ConstraintInterface $constraint1 the first constraint; non-null
+	 * @param ConstraintInterface $constraint2 the second constraint; non-null
 	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\AndInterface the And constraint; non-null
 	 * @throws \TYPO3\CMS\Extbase\Persistence\Generic\Exception\RepositoryException if the operation otherwise fails
 	 */
-	public function _and(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint1, \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint2) {
+	public function _and(ConstraintInterface $constraint1, ConstraintInterface $constraint2) {
 		return $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Qom\\LogicalAnd', $constraint1, $constraint2);
 	}
 
 	/**
 	 * Performs a logical disjunction of two other constraints.
 	 *
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint1 the first constraint; non-null
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint2 the second constraint; non-null
+	 * @param ConstraintInterface $constraint1 the first constraint; non-null
+	 * @param ConstraintInterface $constraint2 the second constraint; non-null
 	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\OrInterface the Or constraint; non-null
 	 * @throws \TYPO3\CMS\Extbase\Persistence\Generic\Exception\RepositoryException if the operation otherwise fails
 	 */
-	public function _or(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint1, \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint2) {
+	public function _or(ConstraintInterface $constraint1, ConstraintInterface $constraint2) {
 		return $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Qom\\LogicalOr', $constraint1, $constraint2);
 	}
 
 	/**
 	 * Performs a logical negation of another constraint.
 	 *
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint the constraint to be negated; non-null
+	 * @param ConstraintInterface $constraint the constraint to be negated; non-null
 	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\NotInterface the Not constraint; non-null
 	 * @throws \TYPO3\CMS\Extbase\Persistence\Generic\Exception\RepositoryException if the operation otherwise fails
 	 */
-	public function not(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint) {
+	public function not(ConstraintInterface $constraint) {
 		return $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Qom\\LogicalNot', $constraint);
 	}
 
 	/**
 	 * Filters node-tuples based on the outcome of a binary operation.
 	 *
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface $operand1 the first operand; non-null
+	 * @param DynamicOperandInterface $operand1 the first operand; non-null
 	 * @param string $operator the operator; one of QueryObjectModelConstants.JCR_OPERATOR_*
 	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\StaticOperandInterface $operand2 the second operand; non-null
 	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ComparisonInterface the constraint; non-null
 	 * @throws \TYPO3\CMS\Extbase\Persistence\Generic\Exception\RepositoryException if the operation otherwise fails
 	 */
-	public function comparison(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface $operand1, $operator, $operand2) {
+	public function comparison(DynamicOperandInterface $operand1, $operator, $operand2) {
 		return $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Qom\\Comparison', $operand1, $operator, $operand2);
 	}
 
@@ -154,22 +154,22 @@ class QueryObjectModelFactory implements \TYPO3\CMS\Core\SingletonInterface {
 	/**
 	 * Evaluates to the lower-case string value (or values, if multi-valued) of an operand.
 	 *
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface $operand the operand whose value is converted to a lower-case string; non-null
+	 * @param DynamicOperandInterface $operand the operand whose value is converted to a lower-case string; non-null
 	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\LowerCaseInterface the operand; non-null
 	 * @throws \TYPO3\CMS\Extbase\Persistence\Generic\Exception\RepositoryException if the operation otherwise fails
 	 */
-	public function lowerCase(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface $operand) {
+	public function lowerCase(DynamicOperandInterface $operand) {
 		return $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Qom\\LowerCase', $operand);
 	}
 
 	/**
 	 * Evaluates to the upper-case string value (or values, if multi-valued) of an operand.
 	 *
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface $operand the operand whose value is converted to a upper-case string; non-null
+	 * @param DynamicOperandInterface $operand the operand whose value is converted to a upper-case string; non-null
 	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\UpperCaseInterface the operand; non-null
 	 * @throws \TYPO3\CMS\Extbase\Persistence\Generic\Exception\RepositoryException if the operation otherwise fails
 	 */
-	public function upperCase(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface $operand) {
+	public function upperCase(DynamicOperandInterface $operand) {
 		return $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Qom\\UpperCase', $operand);
 	}
 
@@ -178,12 +178,12 @@ class QueryObjectModelFactory implements \TYPO3\CMS\Core\SingletonInterface {
 	 *
 	 * The query is invalid if $operand does not evaluate to a scalar value.
 	 *
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface $operand the operand by which to order; non-null
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\OrderingInterface the ordering
+	 * @param DynamicOperandInterface $operand the operand by which to order; non-null
+	 * @return OrderingInterface the ordering
 	 * @throws \TYPO3\CMS\Extbase\Persistence\Generic\Exception\RepositoryException if the operation otherwise fails
 	 */
-	public function ascending(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface $operand) {
-		return $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Qom\\Ordering', $operand, \TYPO3\CMS\Extbase\Persistence\Generic\Qom\QueryObjectModelConstantsInterface::JCR_ORDER_ASCENDING);
+	public function ascending(DynamicOperandInterface $operand) {
+		return $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Qom\\Ordering', $operand, \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING);
 	}
 
 	/**
@@ -191,19 +191,19 @@ class QueryObjectModelFactory implements \TYPO3\CMS\Core\SingletonInterface {
 	 *
 	 * The query is invalid if $operand does not evaluate to a scalar value.
 	 *
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface $operand the operand by which to order; non-null
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\OrderingInterface the ordering
+	 * @param DynamicOperandInterface $operand the operand by which to order; non-null
+	 * @return OrderingInterface the ordering
 	 * @throws \TYPO3\CMS\Extbase\Persistence\Generic\Exception\RepositoryException if the operation otherwise fails
 	 */
-	public function descending(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface $operand) {
-		return $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Qom\\Ordering', $operand, \TYPO3\CMS\Extbase\Persistence\Generic\Qom\QueryObjectModelConstantsInterface::JCR_ORDER_DESCENDING);
+	public function descending(DynamicOperandInterface $operand) {
+		return $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Qom\\Ordering', $operand, \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING);
 	}
 
 	/**
 	 * Evaluates to the value of a bind variable.
 	 *
 	 * @param string $bindVariableName the bind variable name; non-null
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\BindVariableValueInterface the operand; non-null
+	 * @return BindVariableValueInterface the operand; non-null
 	 * @throws \TYPO3\CMS\Extbase\Persistence\Generic\Exception\RepositoryException if the operation otherwise fails
 	 */
 	public function bindVariable($bindVariableName) {
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/QueryObjectModelFactoryInterface.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/QueryObjectModelFactoryInterface.php
index e3cd4e8330194ae60b025ed7546b8d62cbfa8ccc..67545d117da1a85910c0a3453befe156bfe49096 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/QueryObjectModelFactoryInterface.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/QueryObjectModelFactoryInterface.php
@@ -31,7 +31,9 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
  * A QueryObjectModelFactory creates instances of the JCR query object model.
  *
  * Refer to QueryObjectModelInterface for a description of the query object model.
+ *
+ * @deprecated since Extbase 6.2; no replacement, will be removed two versions later
  */
-interface QueryObjectModelFactoryInterface extends \TYPO3\CMS\Extbase\Persistence\Generic\Qom\QueryObjectModelConstantsInterface {
+interface QueryObjectModelFactoryInterface extends QueryObjectModelConstantsInterface {
 
 }
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/Selector.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/Selector.php
index 3db8e81023391f888dc96fda831a1a157813ea14..f23dc4c0fa181fbf8ac22a1bf6abc26db8353f14 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/Selector.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/Selector.php
@@ -38,7 +38,7 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
  * the node has a mixin node type that is nodeType, or
  * the node has a mixin node type that is a subtype of nodeType.
  */
-class Selector implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SelectorInterface {
+class Selector implements SelectorInterface {
 
 	/**
 	 * @var string
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/SelectorInterface.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/SelectorInterface.php
index 17910f1c19e7f1558ee48ec8f6fe8b62322c66fe..2be5a19f5c5e1709b497f01b2062bf9c6456995d 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/SelectorInterface.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/SelectorInterface.php
@@ -38,7 +38,7 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
  * the node has a mixin node type that is nodeType, or
  * the node has a mixin node type that is a subtype of nodeType.
  */
-interface SelectorInterface extends \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface {
+interface SelectorInterface extends SourceInterface {
 
 	/**
 	 * Gets the name of the required node type.
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/Statement.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/Statement.php
index f0bc13938722bc9832e61079647a65b871b212b7..a12c1ee3f948a268cf416f04c58c880b05c3582b 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/Statement.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/Statement.php
@@ -30,7 +30,7 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
 /**
  * A statement acting as a constraint.
  */
-class Statement {
+class Statement implements ConstraintInterface {
 
 	/**
 	 * @var string|\TYPO3\CMS\Core\Database\PreparedStatement
@@ -79,4 +79,13 @@ class Statement {
 	public function getBoundVariables() {
 		return $this->boundVariables;
 	}
+
+	/**
+	 * Fills an array with the names of all bound variables in the constraints
+	 *
+	 * @param array &$boundVariables
+	 * @return void
+	 */
+	public function collectBoundVariableNames(&$boundVariables) {
+	}
 }
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/StaticOperand.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/StaticOperand.php
deleted file mode 100644
index 198060046dcc3714b9beabe2dd11ffe571338246..0000000000000000000000000000000000000000
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/StaticOperand.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2010-2013 Extbase Team (http://forge.typo3.org/projects/typo3v4-mvc)
- *  Extbase is a backport of TYPO3 Flow. All credits go to the TYPO3 Flow team.
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the text file GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * An operand whose value can be determined from static analysis of the query,
- * prior to its evaluation.
- */
-class StaticOperand extends \TYPO3\CMS\Extbase\Persistence\Generic\Qom\Operand implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\StaticOperandInterface {
-
-}
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/StaticOperandInterface.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/StaticOperandInterface.php
index 05a8f9e1861655508f80467aafe0a436304dbefd..e914471e8df609b9c0ace9d6d2238cfd2df95c50 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/StaticOperandInterface.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/StaticOperandInterface.php
@@ -31,6 +31,6 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
  * An operand whose value can be determined from static analysis of the query,
  * prior to its evaluation.
  */
-interface StaticOperandInterface extends \TYPO3\CMS\Extbase\Persistence\Generic\Qom\OperandInterface {
+interface StaticOperandInterface extends OperandInterface {
 
 }
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/UpperCase.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/UpperCase.php
index eae09dc70d822b67175163720107a6836799f8e7..ca1aa55f26b9c0833fe2671a5a0092c9f9c0e728 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/UpperCase.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/UpperCase.php
@@ -38,10 +38,10 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class UpperCase implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\UpperCaseInterface {
+class UpperCase implements UpperCaseInterface {
 
 	/**
-	 * @var \TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface
+	 * @var DynamicOperandInterface
 	 */
 	protected $operand;
 
@@ -50,14 +50,14 @@ class UpperCase implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\UpperCaseI
 	 *
 	 * @param DynamicOperandInterface $operand
 	 */
-	public function __construct(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface $operand) {
+	public function __construct(DynamicOperandInterface $operand) {
 		$this->operand = $operand;
 	}
 
 	/**
 	 * Gets the operand whose value is converted to a upper-case string.
 	 *
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface the operand; non-null
+	 * @return DynamicOperandInterface the operand; non-null
 	 */
 	public function getOperand() {
 		return $this->operand;
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/UpperCaseInterface.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/UpperCaseInterface.php
index 56905703960d4001f141ada1cfc9165badb0f83a..2857dae61798287a0b2f9506ee53464bff71d16b 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/UpperCaseInterface.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Qom/UpperCaseInterface.php
@@ -36,12 +36,12 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
  *
  * If operand evaluates to null, the UpperCase operand also evaluates to null.
  */
-interface UpperCaseInterface extends \TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface {
+interface UpperCaseInterface extends DynamicOperandInterface {
 
 	/**
 	 * Gets the operand whose value is converted to a upper-case string.
 	 *
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface the operand; non-null
+	 * @return DynamicOperandInterface the operand; non-null
 	 */
 	public function getOperand();
 }
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Query.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Query.php
index c9abe717ef9660c9b14544baa4d01231290c1990..964dcb23c52a3756674a8a3e880d073d1384420f 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Query.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Query.php
@@ -27,12 +27,14 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic;
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
+use TYPO3\CMS\Extbase\Persistence\QueryInterface;
+
 /**
  * The Query class used to run queries against the database
  *
  * @api
  */
-class Query implements \TYPO3\CMS\Extbase\Persistence\QueryInterface {
+class Query implements QueryInterface {
 
 	/**
 	 * An inner join.
@@ -116,7 +118,7 @@ class Query implements \TYPO3\CMS\Extbase\Persistence\QueryInterface {
 	/**
 	 * The query settings.
 	 *
-	 * @var \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface
+	 * @var QuerySettingsInterface
 	 */
 	protected $querySettings;
 
@@ -133,11 +135,11 @@ class Query implements \TYPO3\CMS\Extbase\Persistence\QueryInterface {
 	 * Sets the Query Settings. These Query settings must match the settings expected by
 	 * the specific Storage Backend.
 	 *
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface $querySettings The Query Settings
+	 * @param QuerySettingsInterface $querySettings The Query Settings
 	 * @return void
 	 * @api This method is not part of FLOW3 API
 	 */
-	public function setQuerySettings(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface $querySettings) {
+	public function setQuerySettings(QuerySettingsInterface $querySettings) {
 		$this->querySettings = $querySettings;
 	}
 
@@ -145,11 +147,11 @@ class Query implements \TYPO3\CMS\Extbase\Persistence\QueryInterface {
 	 * Returns the Query Settings.
 	 *
 	 * @throws Exception
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface $querySettings The Query Settings
+	 * @return QuerySettingsInterface $querySettings The Query Settings
 	 * @api This method is not part of FLOW3 API
 	 */
 	public function getQuerySettings() {
-		if (!$this->querySettings instanceof \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface) {
+		if (!$this->querySettings instanceof QuerySettingsInterface) {
 			throw new \TYPO3\CMS\Extbase\Persistence\Generic\Exception('Tried to get the query settings without seting them before.', 1248689115);
 		}
 		return $this->querySettings;
@@ -181,8 +183,9 @@ class Query implements \TYPO3\CMS\Extbase\Persistence\QueryInterface {
 	 * @return string The selector name
 	 */
 	protected function getSelectorName() {
-		if ($this->getSource() instanceof \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SelectorInterface) {
-			return $this->source->getSelectorName();
+		$source = $this->getSource();
+		if ($source instanceof \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SelectorInterface) {
+			return $source->getSelectorName();
 		} else {
 			return '';
 		}
@@ -224,7 +227,7 @@ class Query implements \TYPO3\CMS\Extbase\Persistence\QueryInterface {
 	 * where 'foo' and 'bar' are property names.
 	 *
 	 * @param array $orderings The property names to order by
-	 * @return \TYPO3\CMS\Extbase\Persistence\QueryInterface
+	 * @return QueryInterface
 	 * @api
 	 */
 	public function setOrderings(array $orderings) {
@@ -252,7 +255,7 @@ class Query implements \TYPO3\CMS\Extbase\Persistence\QueryInterface {
 	 *
 	 * @param integer $limit
 	 * @throws \InvalidArgumentException
-	 * @return \TYPO3\CMS\Extbase\Persistence\QueryInterface
+	 * @return QueryInterface
 	 * @api
 	 */
 	public function setLimit($limit) {
@@ -267,7 +270,7 @@ class Query implements \TYPO3\CMS\Extbase\Persistence\QueryInterface {
 	 * Resets a previously set maximum size of the result set. Returns $this to allow
 	 * for chaining (fluid interface)
 	 *
-	 * @return \TYPO3\CMS\Extbase\Persistence\QueryInterface
+	 * @return QueryInterface
 	 * @api
 	 */
 	public function unsetLimit() {
@@ -291,7 +294,7 @@ class Query implements \TYPO3\CMS\Extbase\Persistence\QueryInterface {
 	 *
 	 * @param integer $offset
 	 * @throws \InvalidArgumentException
-	 * @return \TYPO3\CMS\Extbase\Persistence\QueryInterface
+	 * @return QueryInterface
 	 * @api
 	 */
 	public function setOffset($offset) {
@@ -317,7 +320,7 @@ class Query implements \TYPO3\CMS\Extbase\Persistence\QueryInterface {
 	 * for chaining (fluid interface)
 	 *
 	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint
-	 * @return \TYPO3\CMS\Extbase\Persistence\QueryInterface
+	 * @return QueryInterface
 	 * @api
 	 */
 	public function matching($constraint) {
@@ -331,7 +334,7 @@ class Query implements \TYPO3\CMS\Extbase\Persistence\QueryInterface {
 	 *
 	 * @param string|\TYPO3\CMS\Core\Database\PreparedStatement $statement The statement
 	 * @param array $parameters An array of parameters. These will be bound to placeholders '?' in the $statement.
-	 * @return \TYPO3\CMS\Extbase\Persistence\QueryInterface
+	 * @return QueryInterface
 	 */
 	public function statement($statement, array $parameters = array()) {
 		$this->statement = $this->qomFactory->statement($statement, $parameters);
@@ -350,7 +353,7 @@ class Query implements \TYPO3\CMS\Extbase\Persistence\QueryInterface {
 	/**
 	 * Gets the constraint for this query.
 	 *
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\Constraint the constraint, or null if none
+	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface|NULL the constraint, or null if none
 	 * @api
 	 */
 	public function getConstraint() {
@@ -411,11 +414,12 @@ class Query implements \TYPO3\CMS\Extbase\Persistence\QueryInterface {
 	/**
 	 * Performs a logical negation of the given constraint
 	 *
-	 * @param object $constraint Constraint to negate
+	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint Constraint to negate
+	 * @throws \RuntimeException
 	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\NotInterface
 	 * @api
 	 */
-	public function logicalNot($constraint) {
+	public function logicalNot(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint) {
 		return $this->qomFactory->not($constraint);
 	}
 
@@ -430,9 +434,17 @@ class Query implements \TYPO3\CMS\Extbase\Persistence\QueryInterface {
 	 */
 	public function equals($propertyName, $operand, $caseSensitive = TRUE) {
 		if (is_object($operand) || $caseSensitive) {
-			$comparison = $this->qomFactory->comparison($this->qomFactory->propertyValue($propertyName, $this->getSelectorName()), \TYPO3\CMS\Extbase\Persistence\QueryInterface::OPERATOR_EQUAL_TO, $operand);
+			$comparison = $this->qomFactory->comparison(
+				$this->qomFactory->propertyValue($propertyName, $this->getSelectorName()),
+				QueryInterface::OPERATOR_EQUAL_TO,
+				$operand
+			);
 		} else {
-			$comparison = $this->qomFactory->comparison($this->qomFactory->lowerCase($this->qomFactory->propertyValue($propertyName, $this->getSelectorName())), \TYPO3\CMS\Extbase\Persistence\QueryInterface::OPERATOR_EQUAL_TO, \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Charset\\CharsetConverter')->conv_case(\TYPO3\CMS\Extbase\Persistence\Generic\Query::CHARSET, $operand, 'toLower'));
+			$comparison = $this->qomFactory->comparison(
+				$this->qomFactory->lowerCase($this->qomFactory->propertyValue($propertyName, $this->getSelectorName())),
+				QueryInterface::OPERATOR_EQUAL_TO,
+				\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Charset\\CharsetConverter')->conv_case(\TYPO3\CMS\Extbase\Persistence\Generic\Query::CHARSET, $operand, 'toLower')
+			);
 		}
 		return $comparison;
 	}
@@ -447,7 +459,7 @@ class Query implements \TYPO3\CMS\Extbase\Persistence\QueryInterface {
 	 * @api
 	 */
 	public function like($propertyName, $operand, $caseSensitive = TRUE) {
-		return $this->qomFactory->comparison($this->qomFactory->propertyValue($propertyName, $this->getSelectorName()), \TYPO3\CMS\Extbase\Persistence\QueryInterface::OPERATOR_LIKE, $operand);
+		return $this->qomFactory->comparison($this->qomFactory->propertyValue($propertyName, $this->getSelectorName()), QueryInterface::OPERATOR_LIKE, $operand);
 	}
 
 	/**
@@ -460,7 +472,7 @@ class Query implements \TYPO3\CMS\Extbase\Persistence\QueryInterface {
 	 * @api
 	 */
 	public function contains($propertyName, $operand) {
-		return $this->qomFactory->comparison($this->qomFactory->propertyValue($propertyName, $this->getSelectorName()), \TYPO3\CMS\Extbase\Persistence\QueryInterface::OPERATOR_CONTAINS, $operand);
+		return $this->qomFactory->comparison($this->qomFactory->propertyValue($propertyName, $this->getSelectorName()), QueryInterface::OPERATOR_CONTAINS, $operand);
 	}
 
 	/**
@@ -475,9 +487,9 @@ class Query implements \TYPO3\CMS\Extbase\Persistence\QueryInterface {
 	 */
 	public function in($propertyName, $operand) {
 		if (!is_array($operand) && !$operand instanceof \ArrayAccess && !$operand instanceof \Traversable) {
-			throw new \TYPO3\CMS\Extbase\Persistence\Generic\Exception\UnexpectedTypeException('The "in" operator must be given a mutlivalued operand (array, ArrayAccess, Traversable).', 1264678095);
+			throw new \TYPO3\CMS\Extbase\Persistence\Generic\Exception\UnexpectedTypeException('The "in" operator must be given a multivalued operand (array, ArrayAccess, Traversable).', 1264678095);
 		}
-		return $this->qomFactory->comparison($this->qomFactory->propertyValue($propertyName, $this->getSelectorName()), \TYPO3\CMS\Extbase\Persistence\QueryInterface::OPERATOR_IN, $operand);
+		return $this->qomFactory->comparison($this->qomFactory->propertyValue($propertyName, $this->getSelectorName()), QueryInterface::OPERATOR_IN, $operand);
 	}
 
 	/**
@@ -489,7 +501,7 @@ class Query implements \TYPO3\CMS\Extbase\Persistence\QueryInterface {
 	 * @api
 	 */
 	public function lessThan($propertyName, $operand) {
-		return $this->qomFactory->comparison($this->qomFactory->propertyValue($propertyName, $this->getSelectorName()), \TYPO3\CMS\Extbase\Persistence\QueryInterface::OPERATOR_LESS_THAN, $operand);
+		return $this->qomFactory->comparison($this->qomFactory->propertyValue($propertyName, $this->getSelectorName()), QueryInterface::OPERATOR_LESS_THAN, $operand);
 	}
 
 	/**
@@ -501,7 +513,7 @@ class Query implements \TYPO3\CMS\Extbase\Persistence\QueryInterface {
 	 * @api
 	 */
 	public function lessThanOrEqual($propertyName, $operand) {
-		return $this->qomFactory->comparison($this->qomFactory->propertyValue($propertyName, $this->getSelectorName()), \TYPO3\CMS\Extbase\Persistence\QueryInterface::OPERATOR_LESS_THAN_OR_EQUAL_TO, $operand);
+		return $this->qomFactory->comparison($this->qomFactory->propertyValue($propertyName, $this->getSelectorName()), QueryInterface::OPERATOR_LESS_THAN_OR_EQUAL_TO, $operand);
 	}
 
 	/**
@@ -513,7 +525,7 @@ class Query implements \TYPO3\CMS\Extbase\Persistence\QueryInterface {
 	 * @api
 	 */
 	public function greaterThan($propertyName, $operand) {
-		return $this->qomFactory->comparison($this->qomFactory->propertyValue($propertyName, $this->getSelectorName()), \TYPO3\CMS\Extbase\Persistence\QueryInterface::OPERATOR_GREATER_THAN, $operand);
+		return $this->qomFactory->comparison($this->qomFactory->propertyValue($propertyName, $this->getSelectorName()), QueryInterface::OPERATOR_GREATER_THAN, $operand);
 	}
 
 	/**
@@ -525,7 +537,7 @@ class Query implements \TYPO3\CMS\Extbase\Persistence\QueryInterface {
 	 * @api
 	 */
 	public function greaterThanOrEqual($propertyName, $operand) {
-		return $this->qomFactory->comparison($this->qomFactory->propertyValue($propertyName, $this->getSelectorName()), \TYPO3\CMS\Extbase\Persistence\QueryInterface::OPERATOR_GREATER_THAN_OR_EQUAL_TO, $operand);
+		return $this->qomFactory->comparison($this->qomFactory->propertyValue($propertyName, $this->getSelectorName()), QueryInterface::OPERATOR_GREATER_THAN_OR_EQUAL_TO, $operand);
 	}
 
 	/**
@@ -562,6 +574,7 @@ class Query implements \TYPO3\CMS\Extbase\Persistence\QueryInterface {
 	 * @param string $propertyName The name of the multivalued property to compare against
 	 * @throws \TYPO3\CMS\Extbase\Persistence\Generic\Exception\NotImplementedException
 	 * @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException if used on a single-valued property
+	 * @return bool
 	 * @api
 	 */
 	public function isEmpty($propertyName) {
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/QueryFactory.php b/typo3/sysext/extbase/Classes/Persistence/Generic/QueryFactory.php
index 2681504c012a75c42ce744ec981fe255b6081d5f..13ff3b11f9bce65226a50ba7ba363f7491f88f85 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/QueryFactory.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/QueryFactory.php
@@ -30,7 +30,7 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic;
 /**
  * The QueryFactory used to create queries against the storage backend
  */
-class QueryFactory implements \TYPO3\CMS\Extbase\Persistence\Generic\QueryFactoryInterface, \TYPO3\CMS\Core\SingletonInterface {
+class QueryFactory implements QueryFactoryInterface, \TYPO3\CMS\Core\SingletonInterface {
 
 	/**
 	 * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/QueryResult.php b/typo3/sysext/extbase/Classes/Persistence/Generic/QueryResult.php
index 4b67942c82168f910257f04d7e2c6c6a26de3e24..c752d9bbcb30d53e5d6e2e7e741611ada2a5cbaf 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/QueryResult.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/QueryResult.php
@@ -27,12 +27,14 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic;
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
+use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
+
 /**
  * A lazy result list that is returned by Query::execute()
  *
  * @api
  */
-class QueryResult implements \TYPO3\CMS\Extbase\Persistence\QueryResultInterface {
+class QueryResult implements QueryResultInterface {
 
 	/**
 	 * This field is only needed to make debugging easier:
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/QuerySettingsInterface.php b/typo3/sysext/extbase/Classes/Persistence/Generic/QuerySettingsInterface.php
index b28895595f14252316d59b63af6a1e3084c85e73..fedd00774ad82079f58f48c827ff254321b5dea4 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/QuerySettingsInterface.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/QuerySettingsInterface.php
@@ -192,4 +192,14 @@ interface QuerySettingsInterface {
 	 * @deprecated since Extbase 6.2, will be removed two versions later
 	 */
 	public function getReturnRawQueryResult();
+
+	/**
+	 * @return bool
+	 */
+	public function getUseQueryCache();
+
+	/**
+	 * @return bool
+	 */
+	public function getUsePreparedStatement();
 }
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Session.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Session.php
index a6fe423a825eac6b7b7375afcd5350f982fd37ce..05d0ce8cfad4dd3ee3141049ae2595519d44c9d2 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Session.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Session.php
@@ -27,6 +27,8 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic;
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
+use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
+
 /**
  * The persistence session - acts as a Unit of Work for Extbase persistence framework.
  */
@@ -35,7 +37,7 @@ class Session implements \TYPO3\CMS\Core\SingletonInterface {
 	/**
 	 * Reconstituted objects
 	 *
-	 * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage
+	 * @var ObjectStorage
 	 */
 	protected $reconstitutedEntities;
 
@@ -49,7 +51,7 @@ class Session implements \TYPO3\CMS\Core\SingletonInterface {
 	protected $reconstitutedEntitiesData = array();
 
 	/**
-	 * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage
+	 * @var ObjectStorage
 	 */
 	protected $objectMap;
 
@@ -68,8 +70,8 @@ class Session implements \TYPO3\CMS\Core\SingletonInterface {
 	 * Constructs a new Session
 	 */
 	public function __construct() {
-		$this->reconstitutedEntities = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
-		$this->objectMap = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
+		$this->reconstitutedEntities = new ObjectStorage();
+		$this->objectMap = new ObjectStorage();
 	}
 
 	/**
@@ -115,7 +117,7 @@ class Session implements \TYPO3\CMS\Core\SingletonInterface {
 	/**
 	 * Returns all objects which have been registered as reconstituted
 	 *
-	 * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage All reconstituted objects
+	 * @return ObjectStorage All reconstituted objects
 	 */
 	public function getReconstitutedEntities() {
 		return $this->reconstitutedEntities;
@@ -198,7 +200,7 @@ class Session implements \TYPO3\CMS\Core\SingletonInterface {
 	/**
 	 * Unregister an object
 	 *
-	 * @param string $object
+	 * @param object $object
 	 * @return void
 	 */
 	public function unregisterObject($object) {
@@ -214,8 +216,8 @@ class Session implements \TYPO3\CMS\Core\SingletonInterface {
 	 */
 	public function destroy() {
 		$this->identifierMap = array();
-		$this->objectMap = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
-		$this->reconstitutedEntities = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
+		$this->objectMap = new ObjectStorage();
+		$this->reconstitutedEntities = new ObjectStorage();
 		$this->reconstitutedEntitiesData = array();
 	}
 
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/BackendInterface.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/BackendInterface.php
index 3ce7e072298a55a3400b400227fdee856e8b9218..a478d845aee70bb5596e8a177e6c3aff6ebf54f3 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/BackendInterface.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/BackendInterface.php
@@ -98,4 +98,13 @@ interface BackendInterface {
 	 * @api
 	 */
 	public function getObjectDataByQuery(\TYPO3\CMS\Extbase\Persistence\QueryInterface $query);
+
+	/**
+	 * Checks if a Value Object equal to the given Object exists in the data base
+	 *
+	 * @param \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject $object The Value Object
+	 * @return mixed The matching uid if an object was found, else FALSE
+	 * @todo this is the last monster in this persistence series. refactor!
+	 */
+	public function getUidOfAlreadyPersistedValueObject(\TYPO3\CMS\Extbase\DomainObject\AbstractValueObject $object);
 }
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php
index 8e7eece1701327aea4b23b8b6dc02b7f037ab715..cd8dc9370508490a0651247db8f9873c98a41631 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php
@@ -29,12 +29,13 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Storage;
  ***************************************************************/
 
 use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Extbase\Persistence\Generic\Qom\Statement;
 use TYPO3\CMS\Extbase\Persistence\QueryInterface;
 
 /**
  * A Storage backend
  */
-class Typo3DbBackend implements \TYPO3\CMS\Extbase\Persistence\Generic\Storage\BackendInterface, \TYPO3\CMS\Core\SingletonInterface {
+class Typo3DbBackend implements BackendInterface, \TYPO3\CMS\Core\SingletonInterface {
 
 	/**
 	 * The TYPO3 database object
@@ -283,12 +284,12 @@ class Typo3DbBackend implements \TYPO3\CMS\Extbase\Persistence\Generic\Storage\B
 	/**
 	 * Returns the object data matching the $query.
 	 *
-	 * @param \TYPO3\CMS\Extbase\Persistence\QueryInterface $query
+	 * @param QueryInterface $query
 	 * @return array
 	 */
-	public function getObjectDataByQuery(\TYPO3\CMS\Extbase\Persistence\QueryInterface $query) {
+	public function getObjectDataByQuery(QueryInterface $query) {
 		$statement = $query->getStatement();
-		if ($statement instanceof \TYPO3\CMS\Extbase\Persistence\Generic\Qom\Statement) {
+		if ($statement instanceof Statement) {
 			$rows = $this->getObjectDataByRawQuery($statement);
 		} else {
 			$rows = $this->getRowsByStatementParts($query);
@@ -323,10 +324,10 @@ class Typo3DbBackend implements \TYPO3\CMS\Extbase\Persistence\Generic\Storage\B
 	/**
 	 * Determines whether to use prepared statement or not and returns the rows from the corresponding method
 	 *
-	 * @param \TYPO3\CMS\Extbase\Persistence\QueryInterface $query
+	 * @param QueryInterface $query
 	 * @return array
 	 */
-	protected function getRowsByStatementParts(\TYPO3\CMS\Extbase\Persistence\QueryInterface $query) {
+	protected function getRowsByStatementParts(QueryInterface $query) {
 		if ($query->getQuerySettings()->getUsePreparedStatement()) {
 			list($statementParts, $parameters) = $this->getStatementParts($query, FALSE);
 			$rows = $this->getRowsFromPreparedDatabase($statementParts, $parameters);
@@ -387,10 +388,10 @@ class Typo3DbBackend implements \TYPO3\CMS\Extbase\Persistence\Generic\Storage\B
 	/**
 	 * Returns the object data using a custom statement
 	 *
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\Statement $statement
+	 * @param Statement $statement
 	 * @return array
 	 */
-	protected function getObjectDataByRawQuery(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\Statement $statement) {
+	protected function getObjectDataByRawQuery(Statement $statement) {
 		$realStatement = $statement->getStatement();
 		$parameters = $statement->getBoundVariables();
 
@@ -426,13 +427,13 @@ class Typo3DbBackend implements \TYPO3\CMS\Extbase\Persistence\Generic\Storage\B
 	/**
 	 * Returns the number of tuples matching the query.
 	 *
-	 * @param \TYPO3\CMS\Extbase\Persistence\QueryInterface $query
+	 * @param QueryInterface $query
 	 * @throws Exception\BadConstraintException
 	 * @return integer The number of matching tuples
 	 */
-	public function getObjectCountByQuery(\TYPO3\CMS\Extbase\Persistence\QueryInterface $query) {
-		if ($query->getConstraint() instanceof \TYPO3\CMS\Extbase\Persistence\Generic\Qom\Statement) {
-			throw new \TYPO3\CMS\Extbase\Persistence\Generic\Storage\Exception\BadConstraintException('Could not execute count on queries with a constraint of type TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Qom\\StatementInterface', 1256661045);
+	public function getObjectCountByQuery(QueryInterface $query) {
+		if ($query->getConstraint() instanceof Statement) {
+			throw new \TYPO3\CMS\Extbase\Persistence\Generic\Storage\Exception\BadConstraintException('Could not execute count on queries with a constraint of type TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Qom\\Statement', 1256661045);
 		}
 
 		list($statementParts) = $this->getStatementParts($query);
@@ -464,57 +465,56 @@ class Typo3DbBackend implements \TYPO3\CMS\Extbase\Persistence\Generic\Storage\B
 	/**
 	 * Looks for the query in cache or builds it up otherwise
 	 *
-	 * @param \TYPO3\CMS\Extbase\Persistence\QueryInterface $query
+	 * @param QueryInterface $query
 	 * @param bool $resolveParameterPlaceholders whether to resolve the parameters or leave the placeholders
 	 * @return array
-	 * @throws \Exception
+	 * @throws \RuntimeException
 	 */
 	protected function getStatementParts($query, $resolveParameterPlaceholders = TRUE) {
-			/**
-			 * The queryParser will preparse the query to get the query's hash and parameters.
-			 * If the hash is found in the cache and useQueryCaching is enabled, extbase will
-			 * then take the string representation from cache and build a prepared query with
-			 * the parameters found.
-			 *
-			 * Otherwise extbase will parse the complete query, build the string representation
-			 * and run a usual query.
-			 */
-			list($queryHash, $parameters) = $this->queryParser->preparseQuery($query);
-
-			if ($query->getQuerySettings()->getUseQueryCache()) {
-				$statementParts = $this->queryCache->get($queryHash);
-
-				if ($queryHash && !$statementParts) {
-					$statementParts = $this->queryParser->parseQuery($query);
-					$this->queryCache->set($queryHash, $statementParts, array(), 0);
-				}
-			} else {
+		/**
+		 * The queryParser will preparse the query to get the query's hash and parameters.
+		 * If the hash is found in the cache and useQueryCaching is enabled, extbase will
+		 * then take the string representation from cache and build a prepared query with
+		 * the parameters found.
+		 *
+		 * Otherwise extbase will parse the complete query, build the string representation
+		 * and run a usual query.
+		 */
+		list($queryHash, $parameters) = $this->queryParser->preparseQuery($query);
+
+		if ($query->getQuerySettings()->getUseQueryCache()) {
+			$statementParts = $this->queryCache->get($queryHash);
+			if ($queryHash && !$statementParts) {
 				$statementParts = $this->queryParser->parseQuery($query);
+				$this->queryCache->set($queryHash, $statementParts, array(), 0);
 			}
+		} else {
+			$statementParts = $this->queryParser->parseQuery($query);
+		}
 
-			if (!$statementParts) {
-				throw new \Exception('Your query could not be built.', 1394453197);
-			}
+		if (!$statementParts) {
+			throw new \RuntimeException('Your query could not be built.', 1394453197);
+		}
 
-			// Limit and offset are not cached to allow caching of pagebrowser queries.
-			$statementParts['limit'] = ((int)$query->getLimit() ?: NULL);
-			$statementParts['offset'] = ((int)$query->getOffset() ?: NULL);
+		// Limit and offset are not cached to allow caching of pagebrowser queries.
+		$statementParts['limit'] = ((int)$query->getLimit() ?: NULL);
+		$statementParts['offset'] = ((int)$query->getOffset() ?: NULL);
 
-			if ($resolveParameterPlaceholders === TRUE) {
-				$statementParts = $this->resolveParameterPlaceholders($statementParts, $parameters);
-			}
+		if ($resolveParameterPlaceholders === TRUE) {
+			$statementParts = $this->resolveParameterPlaceholders($statementParts, $parameters);
+		}
 
-			return array($statementParts, $parameters);
+		return array($statementParts, $parameters);
 	}
 
 	/**
 	 * Replaces the parameters in the queryStructure with given values
 	 *
-	 * @param string $whereStatement
+	 * @param array $statementParts
 	 * @param array $parameters
-	 * @return string
+	 * @return array
 	 */
-	protected function resolveParameterPlaceholders($statementParts, $parameters = array()) {
+	protected function resolveParameterPlaceholders(array $statementParts, array $parameters) {
 		$tableNameForEscape = (reset($statementParts['tables']) ?: 'foo');
 
 		foreach ($parameters as $parameterPlaceholder => $parameter) {
@@ -534,8 +534,8 @@ class Typo3DbBackend implements \TYPO3\CMS\Extbase\Persistence\Generic\Storage\B
 				$parameter = implode(',', $subParameters);
 			} elseif ($parameter === NULL) {
 				$parameter = 'NULL';
-			} elseif (is_bool($input)) {
-				return ($input === TRUE ? 1 : 0);
+			} elseif (is_bool($parameter)) {
+				$parameter = (int)$parameter;
 			} else {
 				$parameter = $this->databaseHandle->fullQuoteStr((string)$parameter, $tableNameForEscape);
 			}
@@ -618,7 +618,7 @@ class Typo3DbBackend implements \TYPO3\CMS\Extbase\Persistence\Generic\Storage\B
 				throw new \TYPO3\CMS\Extbase\Persistence\Generic\Exception\UnexpectedTypeException('An object of class "' . get_class($realInput) . '" could not be converted to a plain value.', 1274799934);
 			}
 		} elseif (is_bool($input)) {
-			return $input === TRUE ? 1 : 0;
+			return (int)$input;
 		} else {
 			return $input;
 		}
@@ -748,68 +748,68 @@ class Typo3DbBackend implements \TYPO3\CMS\Extbase\Persistence\Generic\Storage\B
 	 * @param null|integer $workspaceUid
 	 * @return array
 	 */
-	protected function doLanguageAndWorkspaceOverlay(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface $source, array $rows, $querySettings, $workspaceUid = NULL) {
+	protected function doLanguageAndWorkspaceOverlay(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface $source, array $rows, \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface $querySettings, $workspaceUid = NULL) {
 		if ($source instanceof \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SelectorInterface) {
 			$tableName = $source->getSelectorName();
 		} elseif ($source instanceof \TYPO3\CMS\Extbase\Persistence\Generic\Qom\JoinInterface) {
 			$tableName = $source->getRight()->getSelectorName();
+		} else {
+			// No proper source, so we do not have a table name here
+			// we cannot do an overlay and return the original rows instead.
+			return $rows;
 		}
-		// If we do not have a table name here, we cannot do an overlay and return the original rows instead.
-		if (isset($tableName)) {
-			$pageRepository = $this->getPageRepository();
-			if (is_object($GLOBALS['TSFE'])) {
-				if ($workspaceUid !== NULL) {
-					$pageRepository->versioningWorkspaceId = $workspaceUid;
-				}
-			} else {
-				if ($workspaceUid === NULL) {
-					$workspaceUid = $GLOBALS['BE_USER']->workspace;
-				}
+
+		$pageRepository = $this->getPageRepository();
+		if (is_object($GLOBALS['TSFE'])) {
+			if ($workspaceUid !== NULL) {
 				$pageRepository->versioningWorkspaceId = $workspaceUid;
 			}
-
-			$overlayedRows = array();
-			foreach ($rows as $row) {
-				// If current row is a translation select its parent
-				if (isset($tableName) && isset($GLOBALS['TCA'][$tableName])
-					&& isset($GLOBALS['TCA'][$tableName]['ctrl']['languageField'])
-					&& isset($GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField'])
-					&& !isset($GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerTable'])
-				) {
-					if (isset($row[$GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']])
-						&& $row[$GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']] > 0
-					) {
-						$row = $this->databaseHandle->exec_SELECTgetSingleRow(
-							$tableName . '.*',
-							$tableName,
-							$tableName . '.uid=' . (int)$row[$GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']] .
-								' AND ' . $tableName . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['languageField'] . '=0'
-						);
-					}
-				}
-				$pageRepository->versionOL($tableName, $row, TRUE);
-				if ($pageRepository->versioningPreview && isset($row['_ORIG_uid'])) {
-					$row['uid'] = $row['_ORIG_uid'];
-				}
-				if ($tableName == 'pages') {
-					$row = $pageRepository->getPageOverlay($row, $querySettings->getLanguageUid());
-				} elseif (isset($GLOBALS['TCA'][$tableName]['ctrl']['languageField'])
-					&& $GLOBALS['TCA'][$tableName]['ctrl']['languageField'] !== ''
-					&& !isset($GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerTable'])
+		} else {
+			if ($workspaceUid === NULL) {
+				$workspaceUid = $GLOBALS['BE_USER']->workspace;
+			}
+			$pageRepository->versioningWorkspaceId = $workspaceUid;
+		}
+
+		$overlaidRows = array();
+		foreach ($rows as $row) {
+			// If current row is a translation select its parent
+			if (isset($tableName) && isset($GLOBALS['TCA'][$tableName])
+				&& isset($GLOBALS['TCA'][$tableName]['ctrl']['languageField'])
+				&& isset($GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField'])
+				&& !isset($GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerTable'])
+			) {
+				if (isset($row[$GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']])
+					&& $row[$GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']] > 0
 				) {
-					if (in_array($row[$GLOBALS['TCA'][$tableName]['ctrl']['languageField']], array(-1, 0))) {
-						$overlayMode = $querySettings->getLanguageMode() === 'strict' ? 'hideNonTranslated' : '';
-						$row = $pageRepository->getRecordOverlay($tableName, $row, $querySettings->getLanguageUid(), $overlayMode);
-					}
+					$row = $this->databaseHandle->exec_SELECTgetSingleRow(
+						$tableName . '.*',
+						$tableName,
+						$tableName . '.uid=' . (int)$row[$GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']] .
+							' AND ' . $tableName . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['languageField'] . '=0'
+					);
 				}
-				if ($row !== NULL && is_array($row)) {
-					$overlayedRows[] = $row;
+			}
+			$pageRepository->versionOL($tableName, $row, TRUE);
+			if ($pageRepository->versioningPreview && isset($row['_ORIG_uid'])) {
+				$row['uid'] = $row['_ORIG_uid'];
+			}
+			if ($tableName == 'pages') {
+				$row = $pageRepository->getPageOverlay($row, $querySettings->getLanguageUid());
+			} elseif (isset($GLOBALS['TCA'][$tableName]['ctrl']['languageField'])
+				&& $GLOBALS['TCA'][$tableName]['ctrl']['languageField'] !== ''
+				&& !isset($GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerTable'])
+			) {
+				if (in_array($row[$GLOBALS['TCA'][$tableName]['ctrl']['languageField']], array(-1, 0))) {
+					$overlayMode = $querySettings->getLanguageMode() === 'strict' ? 'hideNonTranslated' : '';
+					$row = $pageRepository->getRecordOverlay($tableName, $row, $querySettings->getLanguageUid(), $overlayMode);
 				}
 			}
-		} else {
-			$overlayedRows = $rows;
+			if ($row !== NULL && is_array($row)) {
+				$overlaidRows[] = $row;
+			}
 		}
-		return $overlayedRows;
+		return $overlaidRows;
 	}
 
 	/**
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbQueryParser.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbQueryParser.php
index d8960a4ad958ade0e7662f299b1f3d905974ea81..22af78c21fe23720eb93d97017dd03d691a5dd1a 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbQueryParser.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbQueryParser.php
@@ -29,7 +29,11 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Storage;
  ***************************************************************/
 
 use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap;
+use TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface;
+use TYPO3\CMS\Extbase\Persistence\QueryInterface;
 use TYPO3\CMS\Extbase\Utility\TypeHandlingUtility;
+use TYPO3\CMS\Extbase\Persistence\Generic\Qom;
 
 /**
  * QueryParser, converting the qom to string representation
@@ -92,10 +96,10 @@ class Typo3DbQueryParser {
 	/**
 	 * Preparses the query and returns the query's hash and the parameters
 	 *
-	 * @param \TYPO3\CMS\Extbase\Persistence\QueryInterface $query The query
+	 * @param QueryInterface $query The query
 	 * @return array the hash and the parameters
 	 */
-	public function preparseQuery(\TYPO3\CMS\Extbase\Persistence\QueryInterface $query) {
+	public function preparseQuery(QueryInterface $query) {
 		list($parameters, $operators) = $this->preparseComparison($query->getConstraint());
 		$hashPartials = array(
 			$query->getQuerySettings(),
@@ -117,7 +121,7 @@ class Typo3DbQueryParser {
 	 * statement. It leaves out the actual statement generation, as it is the most time
 	 * consuming.
 	 *
-	 * @param object $comparison The constraint. Could be And-, Or-, Not- or ComparisonInterface
+	 * @param Qom\ConstraintInterface $comparison The constraint. Could be And-, Or-, Not- or ComparisonInterface
 	 * @param string $qomPath current position of the child in the qom
 	 * @return array Array of parameters and operators
 	 * @throws \Exception
@@ -127,21 +131,23 @@ class Typo3DbQueryParser {
 		$operators = array();
 		$objectsToParse = array();
 
-		if ($comparison instanceof \TYPO3\CMS\Extbase\Persistence\Generic\Qom\AndInterface) {
+		$delimiter = '';
+		if ($comparison instanceof Qom\AndInterface) {
 			$delimiter = 'AND';
 			$objectsToParse = array($comparison->getConstraint1(), $comparison->getConstraint2());
-		} elseif ($comparison instanceof \TYPO3\CMS\Extbase\Persistence\Generic\Qom\OrInterface) {
+		} elseif ($comparison instanceof Qom\OrInterface) {
 			$delimiter = 'OR';
 			$objectsToParse = array($comparison->getConstraint1(), $comparison->getConstraint2());
-		} elseif ($comparison instanceof \TYPO3\CMS\Extbase\Persistence\Generic\Qom\NotInterface) {
+		} elseif ($comparison instanceof Qom\NotInterface) {
 			$delimiter = 'NOT';
 			$objectsToParse = array($comparison->getConstraint());
-		} elseif ($comparison instanceof \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ComparisonInterface) {
-			$parameterIdentifier = $this->normalizeParameterIdentifier($qomPath . $comparison->getOperand1()->getPropertyName());
+		} elseif ($comparison instanceof Qom\ComparisonInterface) {
+			$operand1 = $comparison->getOperand1();
+			$parameterIdentifier = $this->normalizeParameterIdentifier($qomPath . $operand1->getPropertyName());
 			$comparison->setParameterIdentifier($parameterIdentifier);
 			$operator = $comparison->getOperator();
 			$operand2 = $comparison->getOperand2();
-			if ($operator === \TYPO3\CMS\Extbase\Persistence\QueryInterface::OPERATOR_IN) {
+			if ($operator === QueryInterface::OPERATOR_IN) {
 				$items = array();
 				foreach ($operand2 as $value) {
 					$value = $this->getPlainValue($value);
@@ -189,10 +195,10 @@ class Typo3DbQueryParser {
 	/**
 	 * Parses the query and returns the SQL statement parts.
 	 *
-	 * @param \TYPO3\CMS\Extbase\Persistence\QueryInterface $query The query
+	 * @param QueryInterface $query The query
 	 * @return array The SQL statement parts
 	 */
-	public function parseQuery(\TYPO3\CMS\Extbase\Persistence\QueryInterface $query) {
+	public function parseQuery(QueryInterface $query) {
 		$sql = array();
 		$sql['keywords'] = array();
 		$sql['tables'] = array();
@@ -221,18 +227,18 @@ class Typo3DbQueryParser {
 	/**
 	 * Transforms a Query Source into SQL and parameter arrays
 	 *
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface $source The source
+	 * @param Qom\SourceInterface $source The source
 	 * @param array &$sql
 	 * @return void
 	 */
-	protected function parseSource(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface $source, array &$sql) {
-		if ($source instanceof \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SelectorInterface) {
+	protected function parseSource(Qom\SourceInterface $source, array &$sql) {
+		if ($source instanceof Qom\SelectorInterface) {
 			$className = $source->getNodeTypeName();
 			$tableName = $this->dataMapper->getDataMap($className)->getTableName();
 			$this->addRecordTypeConstraint($className, $sql);
 			$sql['fields'][$tableName] = $tableName . '.*';
 			$sql['tables'][$tableName] = $tableName;
-		} elseif ($source instanceof \TYPO3\CMS\Extbase\Persistence\Generic\Qom\JoinInterface) {
+		} elseif ($source instanceof Qom\JoinInterface) {
 			$this->parseJoin($source, $sql);
 		}
 	}
@@ -240,29 +246,29 @@ class Typo3DbQueryParser {
 	/**
 	 * Transforms a constraint into SQL and parameter arrays
 	 *
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint The constraint
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface $source The source
+	 * @param Qom\ConstraintInterface $constraint The constraint
+	 * @param Qom\SourceInterface $source The source
 	 * @param array &$sql The query parts
 	 * @return void
 	 */
-	protected function parseConstraint(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint = NULL, \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface $source, array &$sql) {
-		if ($constraint instanceof \TYPO3\CMS\Extbase\Persistence\Generic\Qom\AndInterface) {
+	protected function parseConstraint(Qom\ConstraintInterface $constraint = NULL, Qom\SourceInterface $source, array &$sql) {
+		if ($constraint instanceof Qom\AndInterface) {
 			$sql['where'][] = '(';
 			$this->parseConstraint($constraint->getConstraint1(), $source, $sql);
 			$sql['where'][] = ' AND ';
 			$this->parseConstraint($constraint->getConstraint2(), $source, $sql);
 			$sql['where'][] = ')';
-		} elseif ($constraint instanceof \TYPO3\CMS\Extbase\Persistence\Generic\Qom\OrInterface) {
+		} elseif ($constraint instanceof Qom\OrInterface) {
 			$sql['where'][] = '(';
 			$this->parseConstraint($constraint->getConstraint1(), $source, $sql);
 			$sql['where'][] = ' OR ';
 			$this->parseConstraint($constraint->getConstraint2(), $source, $sql);
 			$sql['where'][] = ')';
-		} elseif ($constraint instanceof \TYPO3\CMS\Extbase\Persistence\Generic\Qom\NotInterface) {
+		} elseif ($constraint instanceof Qom\NotInterface) {
 			$sql['where'][] = 'NOT (';
 			$this->parseConstraint($constraint->getConstraint(), $source, $sql);
 			$sql['where'][] = ')';
-		} elseif ($constraint instanceof \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ComparisonInterface) {
+		} elseif ($constraint instanceof Qom\ComparisonInterface) {
 			$this->parseComparison($constraint, $source, $sql);
 		}
 	}
@@ -270,24 +276,23 @@ class Typo3DbQueryParser {
 	/**
 	 * Transforms orderings into SQL.
 	 *
-	 * @param array $orderings An array of orderings (Tx_Extbase_Persistence_QOM_Ordering)
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface $source The source
+	 * @param array $orderings An array of orderings (Qom\Ordering)
+	 * @param Qom\SourceInterface $source The source
 	 * @param array &$sql The query parts
-	 * @throws \RuntimeException
 	 * @throws \TYPO3\CMS\Extbase\Persistence\Generic\Exception\UnsupportedOrderException
 	 * @return void
 	 */
-	protected function parseOrderings(array $orderings, \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface $source, array &$sql) {
+	protected function parseOrderings(array $orderings, Qom\SourceInterface $source, array &$sql) {
 		foreach ($orderings as $propertyName => $order) {
 			switch ($order) {
-				case \TYPO3\CMS\Extbase\Persistence\Generic\Qom\QueryObjectModelConstantsInterface::JCR_ORDER_ASCENDING:
+				case Qom\QueryObjectModelConstantsInterface::JCR_ORDER_ASCENDING:
 
-				case \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING:
+				case QueryInterface::ORDER_ASCENDING:
 					$order = 'ASC';
 					break;
-				case \TYPO3\CMS\Extbase\Persistence\Generic\Qom\QueryObjectModelConstantsInterface::JCR_ORDER_DESCENDING:
+				case Qom\QueryObjectModelConstantsInterface::JCR_ORDER_DESCENDING:
 
-				case \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING:
+				case QueryInterface::ORDER_DESCENDING:
 					$order = 'DESC';
 					break;
 				default:
@@ -295,13 +300,13 @@ class Typo3DbQueryParser {
 			}
 			$className = '';
 			$tableName = '';
-			if ($source instanceof \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SelectorInterface) {
+			if ($source instanceof Qom\SelectorInterface) {
 				$className = $source->getNodeTypeName();
 				$tableName = $this->dataMapper->convertClassNameToTableName($className);
 				while (strpos($propertyName, '.') !== FALSE) {
 					$this->addUnionStatement($className, $tableName, $propertyName, $sql);
 				}
-			} elseif ($source instanceof \TYPO3\CMS\Extbase\Persistence\Generic\Qom\JoinInterface) {
+			} elseif ($source instanceof Qom\JoinInterface) {
 				$tableName = $source->getLeft()->getSelectorName();
 			}
 			$columnName = $this->dataMapper->convertPropertyNameToColumnName($propertyName, $className);
@@ -316,19 +321,19 @@ class Typo3DbQueryParser {
 	/**
 	 * Parse a Comparison into SQL and parameter arrays.
 	 *
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ComparisonInterface $comparison The comparison to parse
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface $source The source
+	 * @param Qom\ComparisonInterface $comparison The comparison to parse
+	 * @param Qom\SourceInterface $source The source
 	 * @param array &$sql SQL query parts to add to
+	 * @throws \RuntimeException
 	 * @throws \TYPO3\CMS\Extbase\Persistence\Generic\Exception\RepositoryException
 	 * @return void
 	 */
-	protected function parseComparison(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\ComparisonInterface $comparison, \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface $source, array &$sql) {
+	protected function parseComparison(Qom\ComparisonInterface $comparison, Qom\SourceInterface $source, array &$sql) {
 		$parameterIdentifier = $this->normalizeParameterIdentifier($comparison->getParameterIdentifier());
-		$operand1 = $comparison->getOperand1();
+
 		$operator = $comparison->getOperator();
 		$operand2 = $comparison->getOperand2();
-		if ($operator === \TYPO3\CMS\Extbase\Persistence\QueryInterface::OPERATOR_IN) {
-			$items = array();
+		if ($operator === QueryInterface::OPERATOR_IN) {
 			$hasValue = FALSE;
 			foreach ($operand2 as $value) {
 				$value = $this->getPlainValue($value);
@@ -340,14 +345,18 @@ class Typo3DbQueryParser {
 			if ($hasValue === FALSE) {
 				$sql['where'][] = '1<>1';
 			} else {
-				$this->parseDynamicOperand($comparison, $operator, $source, $sql, NULL);
+				$this->parseDynamicOperand($comparison, $operator, $source, $sql);
 			}
-		} elseif ($operator === \TYPO3\CMS\Extbase\Persistence\QueryInterface::OPERATOR_CONTAINS) {
+		} elseif ($operator === QueryInterface::OPERATOR_CONTAINS) {
 			if ($operand2 === NULL) {
 				$sql['where'][] = '1<>1';
 			} else {
+				if (!$source instanceof Qom\SelectorInterface) {
+					throw new \RuntimeException('Source is not of type "SelectorInterface"', 1395362539);
+				}
 				$className = $source->getNodeTypeName();
 				$tableName = $this->dataMapper->convertClassNameToTableName($className);
+				$operand1 = $comparison->getOperand1();
 				$propertyName = $operand1->getPropertyName();
 				while (strpos($propertyName, '.') !== FALSE) {
 					$this->addUnionStatement($className, $tableName, $propertyName, $sql);
@@ -355,11 +364,11 @@ class Typo3DbQueryParser {
 				$columnName = $this->dataMapper->convertPropertyNameToColumnName($propertyName, $className);
 				$dataMap = $this->dataMapper->getDataMap($className);
 				$columnMap = $dataMap->getColumnMap($propertyName);
-				$typeOfRelation = $columnMap instanceof \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap ? $columnMap->getTypeOfRelation() : NULL;
-				if ($typeOfRelation === \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY) {
+				$typeOfRelation = $columnMap instanceof ColumnMap ? $columnMap->getTypeOfRelation() : NULL;
+				if ($typeOfRelation === ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY) {
 					$relationTableName = $columnMap->getRelationTableName();
 					$sql['where'][] = $tableName . '.uid IN (SELECT ' . $columnMap->getParentKeyFieldName() . ' FROM ' . $relationTableName . ' WHERE ' . $columnMap->getChildKeyFieldName() . '=' . $parameterIdentifier . ')';
-				} elseif ($typeOfRelation === \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap::RELATION_HAS_MANY) {
+				} elseif ($typeOfRelation === ColumnMap::RELATION_HAS_MANY) {
 					$parentKeyFieldName = $columnMap->getParentKeyFieldName();
 					if (isset($parentKeyFieldName)) {
 						$childTableName = $columnMap->getChildTableName();
@@ -379,29 +388,30 @@ class Typo3DbQueryParser {
 	/**
 	 * Parse a DynamicOperand into SQL and parameter arrays.
 	 *
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ComparisonInterface $comparison
+	 * @param Qom\ComparisonInterface $comparison
 	 * @param string $operator One of the JCR_OPERATOR_* constants
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface $source The source
+	 * @param Qom\SourceInterface $source The source
 	 * @param array &$sql The query parts
 	 * @param string $valueFunction an optional SQL function to apply to the operand value
 	 * @return void
 	 */
-	protected function parseDynamicOperand(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\ComparisonInterface $comparison, $operator, \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface $source, array &$sql, $valueFunction = NULL) {
+	protected function parseDynamicOperand(Qom\ComparisonInterface $comparison, $operator, Qom\SourceInterface $source, array &$sql, $valueFunction = NULL) {
 		$operand = $comparison->getOperand1();
-		if ($operand instanceof \TYPO3\CMS\Extbase\Persistence\Generic\Qom\LowerCaseInterface) {
+		if ($operand instanceof Qom\LowerCaseInterface) {
 			$this->parseDynamicOperand($operand->getOperand(), $operator, $source, $sql, 'LOWER');
-		} elseif ($operand instanceof \TYPO3\CMS\Extbase\Persistence\Generic\Qom\UpperCaseInterface) {
+		} elseif ($operand instanceof Qom\UpperCaseInterface) {
 			$this->parseDynamicOperand($operand->getOperand(), $operator, $source, $sql, 'UPPER');
-		} elseif ($operand instanceof \TYPO3\CMS\Extbase\Persistence\Generic\Qom\PropertyValueInterface) {
+		} elseif ($operand instanceof Qom\PropertyValueInterface) {
 			$propertyName = $operand->getPropertyName();
-			if ($source instanceof \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SelectorInterface) {
+			$className = '';
+			if ($source instanceof Qom\SelectorInterface) {
 				// FIXME Only necessary to differ from  Join
 				$className = $source->getNodeTypeName();
 				$tableName = $this->dataMapper->convertClassNameToTableName($className);
 				while (strpos($propertyName, '.') !== FALSE) {
 					$this->addUnionStatement($className, $tableName, $propertyName, $sql);
 				}
-			} elseif ($source instanceof \TYPO3\CMS\Extbase\Persistence\Generic\Qom\JoinInterface) {
+			} elseif ($source instanceof Qom\JoinInterface) {
 				$tableName = $source->getJoinCondition()->getSelector1Name();
 			}
 			$columnName = $this->dataMapper->convertPropertyNameToColumnName($propertyName, $className);
@@ -459,12 +469,12 @@ class Typo3DbQueryParser {
 	/**
 	 * Adds additional WHERE statements according to the query settings.
 	 *
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface $querySettings The TYPO3 CMS specific query settings
+	 * @param QuerySettingsInterface $querySettings The TYPO3 CMS specific query settings
 	 * @param string $tableName The table name to add the additional where clause for
 	 * @param string &$sql
 	 * @return void
 	 */
-	protected function addAdditionalWhereClause(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface $querySettings, $tableName, &$sql) {
+	protected function addAdditionalWhereClause(QuerySettingsInterface $querySettings, $tableName, &$sql) {
 		$this->addVisibilityConstraintStatement($querySettings, $tableName, $sql);
 		if ($querySettings->getRespectSysLanguage()) {
 			$this->addSysLanguageStatement($tableName, $sql, $querySettings);
@@ -477,12 +487,12 @@ class Typo3DbQueryParser {
 	/**
 	 * Adds enableFields and deletedClause to the query if necessary
 	 *
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface $querySettings
+	 * @param QuerySettingsInterface $querySettings
 	 * @param string $tableName The database table name
 	 * @param array &$sql The query parts
 	 * @return void
 	 */
-	protected function addVisibilityConstraintStatement(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface $querySettings, $tableName, array &$sql) {
+	protected function addVisibilityConstraintStatement(QuerySettingsInterface $querySettings, $tableName, array &$sql) {
 		$statement = '';
 		if (is_array($GLOBALS['TCA'][$tableName]['ctrl'])) {
 			$ignoreEnableFields = $querySettings->getIgnoreEnableFields();
@@ -552,7 +562,7 @@ class Typo3DbQueryParser {
 	 *
 	 * @param string $tableName The database table name
 	 * @param array &$sql The query parts
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface $querySettings The TYPO3 CMS specific query settings
+	 * @param QuerySettingsInterface $querySettings The TYPO3 CMS specific query settings
 	 * @return void
 	 */
 	protected function addSysLanguageStatement($tableName, array &$sql, $querySettings) {
@@ -588,6 +598,7 @@ class Typo3DbQueryParser {
 	 * @param string $tableName The database table name
 	 * @param array &$sql The query parts
 	 * @param array $storagePageIds list of storage page ids
+	 * @throws \TYPO3\CMS\Extbase\Persistence\Generic\Exception\InconsistentQuerySettingsException
 	 * @return void
 	 */
 	protected function addPageIdStatement($tableName, array &$sql, array $storagePageIds) {
@@ -614,19 +625,20 @@ class Typo3DbQueryParser {
 	/**
 	 * Transforms a Join into SQL and parameter arrays
 	 *
-	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\JoinInterface $join The join
+	 * @param Qom\JoinInterface $join The join
 	 * @param array &$sql The query parts
 	 * @return void
 	 */
-	protected function parseJoin(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\JoinInterface $join, array &$sql) {
+	protected function parseJoin(Qom\JoinInterface $join, array &$sql) {
 		$leftSource = $join->getLeft();
 		$leftClassName = $leftSource->getNodeTypeName();
-		$this->addRecordTypeConstraint($leftClassName, $sql);
 		$leftTableName = $leftSource->getSelectorName();
+		$this->addRecordTypeConstraint($leftClassName, $sql);
 		$rightSource = $join->getRight();
-		if ($rightSource instanceof \TYPO3\CMS\Extbase\Persistence\Generic\Qom\JoinInterface) {
-			$rightClassName = $rightSource->getLeft()->getNodeTypeName();
-			$rightTableName = $rightSource->getLeft()->getSelectorName();
+		if ($rightSource instanceof Qom\JoinInterface) {
+			$left = $rightSource->getLeft();
+			$rightClassName = $left->getNodeTypeName();
+			$rightTableName = $left->getSelectorName();
 		} else {
 			$rightClassName = $rightSource->getNodeTypeName();
 			$rightTableName = $rightSource->getSelectorName();
@@ -636,12 +648,12 @@ class Typo3DbQueryParser {
 		$sql['tables'][$leftTableName] = $leftTableName;
 		$sql['unions'][$rightTableName] = 'LEFT JOIN ' . $rightTableName;
 		$joinCondition = $join->getJoinCondition();
-		if ($joinCondition instanceof \TYPO3\CMS\Extbase\Persistence\Generic\Qom\EquiJoinCondition) {
+		if ($joinCondition instanceof Qom\EquiJoinCondition) {
 			$column1Name = $this->dataMapper->convertPropertyNameToColumnName($joinCondition->getProperty1Name(), $leftClassName);
 			$column2Name = $this->dataMapper->convertPropertyNameToColumnName($joinCondition->getProperty2Name(), $rightClassName);
 			$sql['unions'][$rightTableName] .= ' ON ' . $joinCondition->getSelector1Name() . '.' . $column1Name . ' = ' . $joinCondition->getSelector2Name() . '.' . $column2Name;
 		}
-		if ($rightSource instanceof \TYPO3\CMS\Extbase\Persistence\Generic\Qom\JoinInterface) {
+		if ($rightSource instanceof Qom\JoinInterface) {
 			$this->parseJoin($rightSource, $sql);
 		}
 	}
@@ -709,14 +721,14 @@ class Typo3DbQueryParser {
 			throw new \TYPO3\CMS\Extbase\Persistence\Generic\Exception\InvalidRelationConfigurationException('The relation information for property "' . $propertyName . '" of class "' . $className . '" is missing.', 1353170925);
 		}
 
-		if ($columnMap->getTypeOfRelation() === \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap::RELATION_HAS_ONE) {
+		if ($columnMap->getTypeOfRelation() === ColumnMap::RELATION_HAS_ONE) {
 			if (isset($parentKeyFieldName)) {
 				$sql['unions'][$childTableName] = 'LEFT JOIN ' . $childTableName . ' ON ' . $tableName . '.uid=' . $childTableName . '.' . $parentKeyFieldName;
 			} else {
 				$sql['unions'][$childTableName] = 'LEFT JOIN ' . $childTableName . ' ON ' . $tableName . '.' . $columnName . '=' . $childTableName . '.uid';
 			}
 			$className = $this->dataMapper->getType($className, $propertyName);
-		} elseif ($columnMap->getTypeOfRelation() === \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap::RELATION_HAS_MANY) {
+		} elseif ($columnMap->getTypeOfRelation() === ColumnMap::RELATION_HAS_MANY) {
 			if (isset($parentKeyFieldName)) {
 				$sql['unions'][$childTableName] = 'LEFT JOIN ' . $childTableName . ' ON ' . $tableName . '.uid=' . $childTableName . '.' . $parentKeyFieldName;
 			} else {
@@ -724,7 +736,7 @@ class Typo3DbQueryParser {
 				$sql['unions'][$childTableName] = 'LEFT JOIN ' . $childTableName . ' ON ' . $onStatement;
 			}
 			$className = $this->dataMapper->getType($className, $propertyName);
-		} elseif ($columnMap->getTypeOfRelation() === \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY) {
+		} elseif ($columnMap->getTypeOfRelation() === ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY) {
 			$relationTableName = $columnMap->getRelationTableName();
 			$sql['unions'][$relationTableName] = 'LEFT JOIN ' . $relationTableName . ' ON ' . $tableName . '.uid=' . $relationTableName . '.' . $columnMap->getParentKeyFieldName();
 			$sql['unions'][$childTableName] = 'LEFT JOIN ' . $childTableName . ' ON ' . $relationTableName . '.' . $columnMap->getChildKeyFieldName() . '=' . $childTableName . '.uid';
@@ -747,34 +759,34 @@ class Typo3DbQueryParser {
 	 */
 	protected function resolveOperator($operator) {
 		switch ($operator) {
-			case \TYPO3\CMS\Extbase\Persistence\QueryInterface::OPERATOR_IN:
+			case QueryInterface::OPERATOR_IN:
 				$operator = 'IN';
 				break;
-			case \TYPO3\CMS\Extbase\Persistence\QueryInterface::OPERATOR_EQUAL_TO:
+			case QueryInterface::OPERATOR_EQUAL_TO:
 				$operator = '=';
 				break;
-			case \TYPO3\CMS\Extbase\Persistence\QueryInterface::OPERATOR_EQUAL_TO_NULL:
+			case QueryInterface::OPERATOR_EQUAL_TO_NULL:
 				$operator = 'IS';
 				break;
-			case \TYPO3\CMS\Extbase\Persistence\QueryInterface::OPERATOR_NOT_EQUAL_TO:
+			case QueryInterface::OPERATOR_NOT_EQUAL_TO:
 				$operator = '!=';
 				break;
-			case \TYPO3\CMS\Extbase\Persistence\QueryInterface::OPERATOR_NOT_EQUAL_TO_NULL:
+			case QueryInterface::OPERATOR_NOT_EQUAL_TO_NULL:
 				$operator = 'IS NOT';
 				break;
-			case \TYPO3\CMS\Extbase\Persistence\QueryInterface::OPERATOR_LESS_THAN:
+			case QueryInterface::OPERATOR_LESS_THAN:
 				$operator = '<';
 				break;
-			case \TYPO3\CMS\Extbase\Persistence\QueryInterface::OPERATOR_LESS_THAN_OR_EQUAL_TO:
+			case QueryInterface::OPERATOR_LESS_THAN_OR_EQUAL_TO:
 				$operator = '<=';
 				break;
-			case \TYPO3\CMS\Extbase\Persistence\QueryInterface::OPERATOR_GREATER_THAN:
+			case QueryInterface::OPERATOR_GREATER_THAN:
 				$operator = '>';
 				break;
-			case \TYPO3\CMS\Extbase\Persistence\QueryInterface::OPERATOR_GREATER_THAN_OR_EQUAL_TO:
+			case QueryInterface::OPERATOR_GREATER_THAN_OR_EQUAL_TO:
 				$operator = '>=';
 				break;
-			case \TYPO3\CMS\Extbase\Persistence\QueryInterface::OPERATOR_LIKE:
+			case QueryInterface::OPERATOR_LIKE:
 				$operator = 'LIKE';
 				break;
 			default:
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Typo3QuerySettings.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Typo3QuerySettings.php
index 6e82b74d8e0c93d1ca564d3321b0943c01d5ec63..c65706cc4f3dfcbd0452311fc3a2b27790cc7373 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Typo3QuerySettings.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Typo3QuerySettings.php
@@ -35,7 +35,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
  *
  * @api
  */
-class Typo3QuerySettings implements \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface {
+class Typo3QuerySettings implements QuerySettingsInterface {
 
 	/**
 	 * Flag if the storage page should be respected for the query.
@@ -158,7 +158,7 @@ class Typo3QuerySettings implements \TYPO3\CMS\Extbase\Persistence\Generic\Query
 	 * Sets the flag if the storage page should be respected for the query.
 	 *
 	 * @param bool $respectStoragePage If TRUE the storage page ID will be determined and the statement will be extended accordingly.
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface
+	 * @return QuerySettingsInterface
 	 * @api
 	 */
 	public function setRespectStoragePage($respectStoragePage) {
@@ -179,7 +179,7 @@ class Typo3QuerySettings implements \TYPO3\CMS\Extbase\Persistence\Generic\Query
 	 * Sets the pid(s) of the storage page(s) that should be respected for the query.
 	 *
 	 * @param array $storagePageIds If given the storage page IDs will be determined and the statement will be extended accordingly.
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface
+	 * @return QuerySettingsInterface
 	 * @api
 	 */
 	public function setStoragePageIds(array $storagePageIds) {
@@ -198,7 +198,7 @@ class Typo3QuerySettings implements \TYPO3\CMS\Extbase\Persistence\Generic\Query
 
 	/**
 	 * @param bool $respectSysLanguage TRUE if TYPO3 language settings are to be applied
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface (fluent interface)
+	 * @return QuerySettingsInterface
 	 * @api
 	 */
 	public function setRespectSysLanguage($respectSysLanguage) {
@@ -215,7 +215,7 @@ class Typo3QuerySettings implements \TYPO3\CMS\Extbase\Persistence\Generic\Query
 
 	/**
 	 * @param mixed $languageOverlayMode TRUE, FALSE or "hideNonTranslated"
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface instance of $this to allow method chaining
+	 * @return QuerySettingsInterface instance of $this to allow method chaining
 	 * @api
 	 */
 	public function setLanguageOverlayMode($languageOverlayMode = FALSE) {
@@ -232,7 +232,7 @@ class Typo3QuerySettings implements \TYPO3\CMS\Extbase\Persistence\Generic\Query
 
 	/**
 	 * @param string $languageMode NULL, "content_fallback", "strict" or "ignore"
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface instance of $this to allow method chaining
+	 * @return QuerySettingsInterface instance of $this to allow method chaining
 	 * @api
 	 */
 	public function setLanguageMode($languageMode = '') {
@@ -249,7 +249,7 @@ class Typo3QuerySettings implements \TYPO3\CMS\Extbase\Persistence\Generic\Query
 
 	/**
 	 * @param int $languageUid
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface instance of $this to allow method chaining
+	 * @return QuerySettingsInterface instance of $this to allow method chaining
 	 * @api
 	 */
 	public function setLanguageUid($languageUid) {
@@ -268,7 +268,7 @@ class Typo3QuerySettings implements \TYPO3\CMS\Extbase\Persistence\Generic\Query
 	 * Sets the language uid for the language overlay.
 	 *
 	 * @param int $sysLanguageUid language uid for the language overlay
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface instance of $this to allow method chaining
+	 * @return QuerySettingsInterface instance of $this to allow method chaining
 	 * @deprecated since Extbase 6.2, will be removed two versions later. Use setLanguageUid() instead.
 	 */
 	public function setSysLanguageUid($sysLanguageUid) {
@@ -291,7 +291,7 @@ class Typo3QuerySettings implements \TYPO3\CMS\Extbase\Persistence\Generic\Query
 	 * Sets the flag if the visibility in the frontend should be respected.
 	 *
 	 * @param bool $respectEnableFields TRUE if the visibility in the frontend should be respected. If TRUE, the "enable fields" of TYPO3 will be added to the query statement.
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface
+	 * @return QuerySettingsInterface
 	 * @deprecated since Extbase 6.0, will be removed two versions later. Use setIgnoreEnableFields() and setEnableFieldsToBeIgnored() instead.
 	 * @see setIgnoreEnableFields()
 	 * @see setEnableFieldsToBeIgnored()
@@ -323,7 +323,7 @@ class Typo3QuerySettings implements \TYPO3\CMS\Extbase\Persistence\Generic\Query
 	 * enable fields are taken into account, regardless of the enableFieldsToBeIgnored setting.
 	 *
 	 * @param bool $ignoreEnableFields
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface
+	 * @return QuerySettingsInterface
 	 * @see setEnableFieldsToBeIgnored()
 	 * @api
 	 */
@@ -351,7 +351,7 @@ class Typo3QuerySettings implements \TYPO3\CMS\Extbase\Persistence\Generic\Query
 	 * by this column. This setting is only taken into account if $this->ignoreEnableFields = TRUE.
 	 *
 	 * @param array $enableFieldsToBeIgnored
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface
+	 * @return QuerySettingsInterface
 	 * @see setIgnoreEnableFields()
 	 * @api
 	 */
@@ -375,7 +375,7 @@ class Typo3QuerySettings implements \TYPO3\CMS\Extbase\Persistence\Generic\Query
 	 * Sets the flag if the query should return objects that are deleted.
 	 *
 	 * @param bool $includeDeleted
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface
+	 * @return QuerySettingsInterface
 	 * @api
 	 */
 	public function setIncludeDeleted($includeDeleted) {
@@ -396,7 +396,7 @@ class Typo3QuerySettings implements \TYPO3\CMS\Extbase\Persistence\Generic\Query
 	 * Sets the state, if the QueryResult should be returned unmapped.
 	 *
 	 * @param bool $returnRawQueryResult TRUE, if the QueryResult should be returned unmapped; otherwise FALSE.
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface
+	 * @return QuerySettingsInterface
 	 * @deprecated since Extbase 6.2, will be removed two versions later. Please use argument in query->execute() instead.
 	 */
 	public function setReturnRawQueryResult($returnRawQueryResult) {
@@ -418,7 +418,7 @@ class Typo3QuerySettings implements \TYPO3\CMS\Extbase\Persistence\Generic\Query
 
 	/**
 	 * @param bool $usePreparedStatement
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface
+	 * @return QuerySettingsInterface
 	 */
 	public function usePreparedStatement($usePreparedStatement) {
 		$this->usePreparedStatement = $usePreparedStatement;
@@ -434,7 +434,7 @@ class Typo3QuerySettings implements \TYPO3\CMS\Extbase\Persistence\Generic\Query
 
 	/**
 	 * @param bool $useQueryCache
-	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface
+	 * @return QuerySettingsInterface
 	 */
 	public function useQueryCache($useQueryCache) {
 		$this->useQueryCache = $useQueryCache;
diff --git a/typo3/sysext/extbase/Classes/Persistence/ObjectStorage.php b/typo3/sysext/extbase/Classes/Persistence/ObjectStorage.php
index 84fa1d6f23e80b90ed7708a0fa81472da931d37e..f8d68bb85f6f6b84acf4a9d70f3c9216dd8f1e65 100644
--- a/typo3/sysext/extbase/Classes/Persistence/ObjectStorage.php
+++ b/typo3/sysext/extbase/Classes/Persistence/ObjectStorage.php
@@ -33,7 +33,7 @@ namespace TYPO3\CMS\Extbase\Persistence;
  *
  * Opposed to the SplObjectStorage the ObjectStorage does not implement the Serializable interface.
  */
-class ObjectStorage implements \Countable, \Iterator, \ArrayAccess, \TYPO3\CMS\Extbase\Persistence\ObjectMonitoringInterface {
+class ObjectStorage implements \Countable, \Iterator, \ArrayAccess, ObjectMonitoringInterface {
 
 	/**
 	 * This field is only needed to make debugging easier:
@@ -258,10 +258,10 @@ class ObjectStorage implements \Countable, \Iterator, \ArrayAccess, \TYPO3\CMS\E
 	/**
 	 * Adds all objects-data pairs from a different storage in the current storage.
 	 *
-	 * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $objectStorage
+	 * @param ObjectStorage $objectStorage
 	 * @return void
 	 */
-	public function addAll(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $objectStorage) {
+	public function addAll(ObjectStorage $objectStorage) {
 		foreach ($objectStorage as $object) {
 			$this->attach($object, $objectStorage->getInfo());
 		}
@@ -270,10 +270,10 @@ class ObjectStorage implements \Countable, \Iterator, \ArrayAccess, \TYPO3\CMS\E
 	/**
 	 * Removes objects contained in another storage from the current storage.
 	 *
-	 * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $objectStorage The storage containing the elements to remove.
+	 * @param ObjectStorage $objectStorage The storage containing the elements to remove.
 	 * @return void
 	 */
-	public function removeAll(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $objectStorage) {
+	public function removeAll(ObjectStorage $objectStorage) {
 		foreach ($objectStorage as $object) {
 			$this->detach($object);
 		}
diff --git a/typo3/sysext/extbase/Classes/Persistence/PersistenceManagerInterface.php b/typo3/sysext/extbase/Classes/Persistence/PersistenceManagerInterface.php
index d8c4db9a27ed29fecf1a497bae70c0d8cac6e152..92a6ef4a5dd1d2c4bca56aeb1888ce8d95042fa8 100644
--- a/typo3/sysext/extbase/Classes/Persistence/PersistenceManagerInterface.php
+++ b/typo3/sysext/extbase/Classes/Persistence/PersistenceManagerInterface.php
@@ -91,22 +91,22 @@ interface PersistenceManagerInterface {
 	/**
 	 * Returns the number of records matching the query.
 	 *
-	 * @param \TYPO3\CMS\Extbase\Persistence\QueryInterface $query
+	 * @param QueryInterface $query
 	 * @return integer
 	 * @deprecated since Extbase 6.0, will be removed in Extbase 7.0
 	 * @api
 	 */
-	public function getObjectCountByQuery(\TYPO3\CMS\Extbase\Persistence\QueryInterface $query);
+	public function getObjectCountByQuery(QueryInterface $query);
 
 	/**
 	 * Returns the object data matching the $query.
 	 *
-	 * @param \TYPO3\CMS\Extbase\Persistence\QueryInterface $query
+	 * @param QueryInterface $query
 	 * @return array
 	 * @deprecated since Extbase 6.0, will be removed in Extbase 7.0
 	 * @api
 	 */
-	public function getObjectDataByQuery(\TYPO3\CMS\Extbase\Persistence\QueryInterface $query);
+	public function getObjectDataByQuery(QueryInterface $query);
 
 	/**
 	 * Registers a repository
@@ -180,7 +180,7 @@ interface PersistenceManagerInterface {
 	 * Return a query object for the given type.
 	 *
 	 * @param string $type
-	 * @return \TYPO3\CMS\Extbase\Persistence\QueryInterface
+	 * @return QueryInterface
 	 * @api
 	 */
 	public function createQueryForType($type);
diff --git a/typo3/sysext/extbase/Classes/Persistence/QueryInterface.php b/typo3/sysext/extbase/Classes/Persistence/QueryInterface.php
index e63b57a0c5e803d3d7c4405dc7415c598e68892a..b4a41ff7d6fc361b78dd58e7a14d0ec459fef4df 100644
--- a/typo3/sysext/extbase/Classes/Persistence/QueryInterface.php
+++ b/typo3/sysext/extbase/Classes/Persistence/QueryInterface.php
@@ -216,11 +216,11 @@ interface QueryInterface {
 	/**
 	 * Performs a logical negation of the given constraint
 	 *
-	 * @param object $constraint Constraint to negate
-	 * @return object
+	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint Constraint to negate
+	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\NotInterface
 	 * @api
 	 */
-	public function logicalNot($constraint);
+	public function logicalNot(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint);
 
 	/**
 	 * Returns an equals criterion used for matching objects against a query.
@@ -232,7 +232,7 @@ interface QueryInterface {
 	 * @param string $propertyName The name of the property to compare against
 	 * @param mixed $operand The value to compare with
 	 * @param boolean $caseSensitive Whether the equality test should be done case-sensitive for strings
-	 * @return object
+	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ComparisonInterface
 	 * @api
 	 */
 	public function equals($propertyName, $operand, $caseSensitive = TRUE);
@@ -339,13 +339,13 @@ interface QueryInterface {
 	 * @todo decide whether this can be deprecated somewhen
 	 * @api This method is not part of TYPO3Flow API
 	 */
-	public function setQuerySettings(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface $querySettings);
+	public function setQuerySettings(Generic\QuerySettingsInterface $querySettings);
 
 	/**
 	 * Returns the Query Settings.
 	 *
 	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface $querySettings The Query Settings
-	 * @todo decide whether this can be deprecated somewhen
+	 * @todo decide whether this can be deprecated eventually
 	 * @api This method is not part of  TYPO3Flow API
 	 */
 	public function getQuerySettings();
@@ -389,7 +389,7 @@ interface QueryInterface {
 	/**
 	 * Gets the constraint for this query.
 	 *
-	 * @return mixed the constraint, or null if none
+	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface|NULL the constraint, or null if none
 	 * @api
 	 */
 	public function getConstraint();
@@ -404,4 +404,19 @@ interface QueryInterface {
 	 * @api
 	 */
 	public function isEmpty($propertyName);
+
+	/**
+	 * Sets the source to fetch the result from
+	 *
+	 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface $source
+	 */
+	public function setSource(Generic\Qom\SourceInterface $source);
+
+	/**
+	 * Returns the statement of this query.
+	 *
+	 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\Statement
+	 */
+	public function getStatement();
+
 }
diff --git a/typo3/sysext/extbase/Classes/Persistence/Repository.php b/typo3/sysext/extbase/Classes/Persistence/Repository.php
index 03ca6eae8a5079ac1a3ec0c6aa62e29d0cfd7921..754ab30e8f832e07209db38f98f979dfea0d4c8d 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Repository.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Repository.php
@@ -32,7 +32,7 @@ namespace TYPO3\CMS\Extbase\Persistence;
  *
  * @api
  */
-class Repository implements \TYPO3\CMS\Extbase\Persistence\RepositoryInterface, \TYPO3\CMS\Core\SingletonInterface {
+class Repository implements RepositoryInterface, \TYPO3\CMS\Core\SingletonInterface {
 
 	/**
 	 * @var \TYPO3\CMS\Extbase\Persistence\Generic\IdentityMap
@@ -153,7 +153,7 @@ class Repository implements \TYPO3\CMS\Extbase\Persistence\RepositoryInterface,
 	/**
 	 * Returns all objects of this repository.
 	 *
-	 * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface|array
+	 * @return QueryResultInterface|array
 	 * @api
 	 */
 	public function findAll() {
@@ -292,7 +292,7 @@ class Repository implements \TYPO3\CMS\Extbase\Persistence\RepositoryInterface,
 			$query = $this->createQuery();
 
 			$result = $query->matching($query->equals($propertyName, $arguments[0]))->setLimit(1)->execute();
-			if ($result instanceof \TYPO3\CMS\Extbase\Persistence\QueryResultInterface) {
+			if ($result instanceof QueryResultInterface) {
 				return $result->getFirst();
 			} elseif (is_array($result)) {
 				return isset($result[0]) ? $result[0] : NULL;
diff --git a/typo3/sysext/extbase/Tests/Unit/Persistence/Generic/QueryTest.php b/typo3/sysext/extbase/Tests/Unit/Persistence/Generic/QueryTest.php
index 309870aa6691366b1e596c0ee72e3b4e142c8895..1bb0f69e5f586db7f0bb4d74271482e234ee1601 100644
--- a/typo3/sysext/extbase/Tests/Unit/Persistence/Generic/QueryTest.php
+++ b/typo3/sysext/extbase/Tests/Unit/Persistence/Generic/QueryTest.php
@@ -164,7 +164,7 @@ class QueryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 		/** @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject $objectManager */
 		$objectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
 		/** @var \TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface $dynamicOperand */
-		$dynamicOperand = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Qom\\DynamicOperand');
+		$dynamicOperand = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Qom\\DynamicOperandInterface');
 		$objectManager->expects($this->any())->method('get')->will($this->returnValue($dynamicOperand));
 		/** @var $qomFactory \TYPO3\CMS\Extbase\Persistence\Generic\Qom\QueryObjectModelFactory */
 		$qomFactory = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Qom\\QueryObjectModelFactory', array('comparison'));