I've seen many topic beginning with that message but I can't find a topic related to my problem.
Here is the code that create the exception with the error message : "SQLSTATE[HY000]: General error". My problem is : I have nothing except "General error". Actually, there are no error : the lines I want to delete are correctly deleted as far as I can tell. If I use the query in phpMyAdmin, I've got no error. I would like to know why I've got this error while everthing seems to be ok.
public function deleteAllUnused() {
    try {
        $rsm = new ResultSetMappingBuilder($this->getEntityManager());
        $rsm->addRootEntityFromClassMetadata("\Entity\CataloguePrixDetailProduit", "cpdp");
        $sqlRequest = $this->buildDeleteAllUnusedRequest();
        return $this->getEntityManager()
                ->createNativeQuery($sqlRequest, $rsm)
                ->execute();
    } catch (Exception $exc) {
        throw new Exception($exc->getMessage());
    }
}
private function buildDeleteAllUnusedRequest() {
    return 
    "DELETE cpdp.*\n"
    . "FROM CataloguePrixDetailProduit cpdp JOIN (\n"
        . "SELECT cpdp2.idCataloguePrixDetailProduit\n"
        . "FROM CataloguePrixDetailProduit cpdp2\n"
        . "WHERE cpdp2.idCataloguePrixDetailProduit NOT IN (\n"
            . "SELECT DISTINCT(cpdp3.idCataloguePrixDetailProduit)\n"
            . "FROM CataloguePrixDetailProduit cpdp3\n"
            . "INNER JOIN CatalogueExploitantFournisseur cef ON cpdp3.idCatalogueExploitantFournisseur = cef.idCatalogueExploitantFournisseur\n"
            . "INNER JOIN CatalogueExploitant ce ON cef.idCatalogueExploitant = ce.idCatalogueExploitant\n"
            . "INNER JOIN DetailProduitCommandeServiceValide dpcsv \n"
                . "ON dpcsv.idDetailProduit = cpdp3.idDetailProduit\n"
                . "AND dpcsv.idFournisseur = cef.idFournisseur\n"
                . "AND dpcsv.idExploitant = ce.idExploitant\n"
        . ")\n"
    . ") r ON r.idCataloguePrixDetailProduit = cpdp.idCataloguePrixDetailProduit";
}
I don't understand what went wrong. I can't keep an application which is sending error message for no reason.
EDIT : Here is the Exception Stack :
[10:02:38][Repository\CataloguePrixDetailProduitRepository][deleteAllUnused] : SQLSTATE[HY000]: General error
#0 C:\xampp\htdocs\projects\Sogesa\applications\SogesaWeb\library\DoctrineOrm\Doctrine\ORM\Internal\Hydration\ObjectHydrator.php(148): PDOStatement->fetch(2)
#1 C:\xampp\htdocs\projects\Sogesa\applications\SogesaWeb\library\DoctrineOrm\Doctrine\ORM\Internal\Hydration\AbstractHydrator.php(111): Doctrine\ORM\Internal\Hydration\ObjectHydrator->hydrateAllData()
#2 C:\xampp\htdocs\projects\Sogesa\applications\SogesaWeb\library\DoctrineOrm\Doctrine\ORM\AbstractQuery.php(747): Doctrine\ORM\Internal\Hydration\AbstractHydrator->hydrateAll(Object(Doctrine\DBAL\Driver\PDOStatement), Object(Doctrine\ORM\Query\ResultSetMappingBuilder), Array)
#3 C:\xampp\htdocs\projects\Sogesa\applications\SogesaWeb\model\Repository\CataloguePrixDetailProduitRepository.php(107): Doctrine\ORM\AbstractQuery->execute()
#4 C:\xampp\htdocs\projects\Sogesa\applications\SogesaWeb\controller\CataloguePrixDetailProduitController.php(196): Repository\CataloguePrixDetailProduitRepository->deleteAllUnused()
#5 C:\xampp\htdocs\projects\Sogesa\applications\SogesaWeb\library\Dispatcher.php(60): CataloguePrixDetailProduitController->ajaxLoadedFlushPrixUnused()
#6 C:\xampp\htdocs\projects\Sogesa\applications\SogesaWeb\library\Dispatcher.php(11): Dispatcher->callAction(Object(CataloguePrixDetailProduitController))
#7 C:\xampp\htdocs\projects\Sogesa\applications\SogesaWeb\webroot\index.php(21): Dispatcher->__construct()
#8 {main}
Thanks for your time.
 
     
     
    