<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Sun May 19 07:12:26 UTC 2013

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary add field=key&field=summary to the URL of your request.
For example:
http://www.doctrine-project.org/jira/si/jira.issueviews:issue-xml/DDC-2175/DDC-2175.xml?field=key&field=summary
-->
<rss version="0.92" >
<channel>
    <title>Doctrine Project</title>
    <link>http://www.doctrine-project.org/jira</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>5.2.7</version>
        <build-number>850</build-number>
        <build-date>21-02-2013</build-date>
    </build-info>

<item>
            <title>[DDC-2175] Optimistic locking version not refreshed on update for class table inheritance</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2175</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;I am trying to use optimistic locking with class table inheritance.  I put the version column in the base table.  When I perform change a base entity value, persist, and flush, the version in memory does not update to match the new version in the base table.  Consequently, subsequent updates fail with &quot;The optimistic lock on an entity failed.&quot;&lt;/p&gt;

&lt;p&gt;As far as I can tell, the reason is that the update method in Doctrine/ORM/Persisters/JoinedSubclassPersister.php does not call assignDefaultVersionValue in this case.&lt;/p&gt;

&lt;p&gt;This change appears to fix the problem.&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
--- a/lib/Doctrine/ORM/Persisters/JoinedSubclassPersister.php
+++ b/lib/Doctrine/ORM/Persisters/JoinedSubclassPersister.php
@@ -227,9 +227,10 @@ class JoinedSubclassPersister &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; AbstractEntityInheritancePersister
 
             &lt;span class=&quot;code-comment&quot;&gt;// Make sure the table with the version column is updated even &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; no columns on that
&lt;/span&gt;             &lt;span class=&quot;code-comment&quot;&gt;// table were affected.
&lt;/span&gt;-            &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($isVersioned &amp;amp;&amp;amp; ! isset($updateData[$versionedTable])) {
-                $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_updateTable($entity, $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;quoteStrategy-&amp;gt;getTableName($versionedClass, $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_platform), array(), &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;);
-
+            &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($isVersioned) {
+                &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (! isset($updateData[$versionedTable])) {
+                    $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_updateTable($entity, $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;quoteStrategy-&amp;gt;getTableName($versionedClass, $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_platform), array(), &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;);
+                }
                 $id = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_em-&amp;gt;getUnitOfWork()-&amp;gt;getEntityIdentifier($entity);
                 $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;assignDefaultVersionValue($entity, $id);
             }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The new code then looks like this:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
            &lt;span class=&quot;code-comment&quot;&gt;// Make sure the table with the version column is updated even &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; no columns on that
&lt;/span&gt;            &lt;span class=&quot;code-comment&quot;&gt;// table were affected.
&lt;/span&gt;            &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($isVersioned) {
                &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (! isset($updateData[$versionedTable])) {
                    $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_updateTable($entity, $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;quoteStrategy-&amp;gt;getTableName($versionedClass, $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_platform), array(), &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;);
                }   
                $id = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_em-&amp;gt;getUnitOfWork()-&amp;gt;getEntityIdentifier($entity);
                $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;assignDefaultVersionValue($entity, $id);
            }   
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

</description>
                <environment></environment>
            <key id="14278">DDC-2175</key>
            <summary>Optimistic locking version not refreshed on update for class table inheritance</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="5" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/resolved.png">Resolved</status>
                    <resolution id="1">Fixed</resolution>
                    <security id="10000">All</security>
                        <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="colin">Colin Campbell</reporter>
                        <labels>
                    </labels>
                <created>Wed, 28 Nov 2012 01:40:44 +0000</created>
                <updated>Mon, 24 Dec 2012 10:20:10 +0000</updated>
                    <resolved>Mon, 24 Dec 2012 10:20:10 +0000</resolved>
                            <version>2.3</version>
                                <fixVersion>2.3.2</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>