DDC-2929: Pessimistic lock on Query does not update the entity with the DB values if it's already cached #3689

doctrinebot opened this Issue Jan 22, 2014 · 2 comments

3 participants


Jira issue originally created by user nail:

When asking for a pessimistic lock through a Query object, the entities already in the cache are not refreshed with the latest values from the database (unless you set the Query::HINT_REFRESH hint)


        try {
            $bar = $em->createQuery('SELECT b FROM Foo:Bar b WHERE b.id = :id')
                        ->setParameter('id', 150)
            var_dump($bar->getAmount()); // Yields some positive value
            $bar = $em->createQuery('SELECT b FROM Foo:Bar b WHERE b.id = :id')
                        ->setParameter('id', 150)
                        // ->setHint(\Doctrine\ORM\Query::HINT_REFRESH, true)
            var_dump($bar->getAmount()); // Yields 0

        } catch (\Exception $e) {

This is similar to DDC-1846

(Tested on 2.4.0 and 2.4.1)

@beberlei beberlei was assigned by doctrinebot Dec 6, 2015
@doctrinebot doctrinebot added the Bug label Dec 7, 2015

Are you guys interested about fix this? It is serious bug, which caused domain inconsistency in my application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment