<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Wed May 22 19:03:51 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-633/DDC-633.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-633] fetch=&quot;EAGER&quot; is not loading one to one associations</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-633</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&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;&amp;lt;?php
namespace vo;

/**
 * @Entity
 */

class Appointment {
	
    /** @Id @Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;integer&quot;&lt;/span&gt;) @GeneratedValue(strategy=&lt;span class=&quot;code-quote&quot;&gt;&quot;IDENTITY&quot;&lt;/span&gt;) */
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; $id;
	
	/**
     * @OneToOne(targetEntity=&lt;span class=&quot;code-quote&quot;&gt;&quot;Patient&quot;&lt;/span&gt;, inversedBy=&lt;span class=&quot;code-quote&quot;&gt;&quot;appointment&quot;&lt;/span&gt;, fetch=&lt;span class=&quot;code-quote&quot;&gt;&quot;EAGER&quot;&lt;/span&gt;)
	 * @JoinColumn(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;patient_id&quot;&lt;/span&gt;, referencedColumnName=&lt;span class=&quot;code-quote&quot;&gt;&quot;id&quot;&lt;/span&gt;)
     */
	&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; $patient;
	
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;When doing a findAll() on appointments, $patient is being created as a proxy even though fetch is EAGER.&lt;/p&gt;</description>
                <environment></environment>
            <key id="11477">DDC-633</key>
            <summary>fetch=&quot;EAGER&quot; is not loading one to one associations</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="2" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/critical.png">Critical</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="ccapndave">Dave Keen</reporter>
                        <labels>
                    </labels>
                <created>Fri, 11 Jun 2010 15:25:08 +0000</created>
                <updated>Tue, 28 Sep 2010 15:19:25 +0000</updated>
                    <resolved>Sun, 8 Aug 2010 05:05:54 +0000</resolved>
                                            <fixVersion>2.0-BETA4</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="13834" author="beberlei" created="Sun, 8 Aug 2010 05:05:54 +0000"  >&lt;p&gt;Fixed in master&lt;/p&gt;</comment>
                    <comment id="13976" author="majkl578" created="Tue, 17 Aug 2010 12:19:19 +0000"  >&lt;p&gt;What is an advantage of this solution (in master) if it is loaded in the same way as when fetched lazily? Maybe it&apos;d be better to use INNER JOIN instead, at least for OneToOne and save one or more (probably unnecessary) SQL queries?&lt;/p&gt;</comment>
                    <comment id="13978" author="beberlei" created="Tue, 17 Aug 2010 12:40:01 +0000"  >&lt;p&gt;There is none (yet), it may be a future enhancement, however we dont know this yet. fetch=EAGER is not so useful at the moment.&lt;/p&gt;</comment>
                    <comment id="13989" author="majkl578" created="Tue, 17 Aug 2010 18:08:24 +0000"  >&lt;p&gt;I think that fetch=EAGER should behave like this DQL:&lt;br/&gt;
SELECT a, b FROM foo a JOIN a.bar b&lt;br/&gt;
This query will use INNER JOIN to load &quot;a.bar&quot; association, but fetch=EAGER won&apos;t.&lt;/p&gt;

&lt;p&gt;Should I open a new issue for this?&lt;/p&gt;</comment>
                    <comment id="14483" author="edke" created="Tue, 28 Sep 2010 11:01:08 +0000"  >&lt;p&gt;fetch=EAGER still is not working as I think it should.&lt;/p&gt;

&lt;p&gt;class Project  {&lt;/p&gt;

&lt;p&gt;    /**&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;@id&lt;/li&gt;
	&lt;li&gt;@column(type=&quot;integer&quot;)&lt;/li&gt;
	&lt;li&gt;@generatedValue(strategy=&quot;SEQUENCE&quot;)&lt;br/&gt;
     */&lt;br/&gt;
    private $id;&lt;br/&gt;
    /**&lt;/li&gt;
	&lt;li&gt;@manyToOne(targetEntity=&quot;Client&quot;, inversedBy=&quot;projects&quot;, fetch=&quot;EAGER&quot;)&lt;/li&gt;
	&lt;li&gt;@joinColumn(name=&quot;id_client&quot;, referencedColumnName=&quot;id&quot;,nullable=false, onDelete=&quot;cascade&quot;)&lt;br/&gt;
     */&lt;br/&gt;
    private $client;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;but after &lt;/p&gt;

&lt;p&gt;$this-&amp;gt;getEntityManager()&lt;del&gt;&amp;gt;find(&apos;\Entities\Project&apos;, $this&lt;/del&gt;&amp;gt;project);&lt;/p&gt;

&lt;p&gt;2 doctrine queries are executed:&lt;/p&gt;

&lt;p&gt;SELECT t0.id AS id1, t0.name AS name2, t0.paths AS paths3, t0.modified AS modified4, t0.created AS&lt;br/&gt;
created5, t0.has_running_tasks AS has_running_tasks6, t0.tasksCount AS taskscount7, t0.productsCount&lt;br/&gt;
AS productscount8, t0.id_client AS id_client9 &lt;br/&gt;
FROM projects t0 &lt;br/&gt;
WHERE t0.id = ?&lt;/p&gt;

&lt;p&gt;SELECT t0.id AS id1, t0.name AS name2, t0.modified AS modified3, t0.created AS created4 &lt;br/&gt;
FROM clients t0 &lt;br/&gt;
WHERE t0.id = ?&lt;/p&gt;

&lt;p&gt;And it should be one query with inner join to clients.&lt;/p&gt;</comment>
                    <comment id="14484" author="beberlei" created="Tue, 28 Sep 2010 13:01:13 +0000"  >&lt;p&gt;Eager doesnt mean it does a Join, it only means the query is executed directly&lt;/p&gt;</comment>
                    <comment id="14485" author="edke" created="Tue, 28 Sep 2010 15:19:25 +0000"  >&lt;p&gt;I see. And how can be achieved that product and client will be queried at once, and not only when I request product-&amp;gt;getClient() ? &lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>