<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: Eager Loading</title><link>https://answers.axonivy.com/questions/2311/eager-loading</link><description>&lt;p&gt;Hello Ivy Team,&lt;/p&gt;
&lt;p&gt;In my project, I had to switch from the default Eager loading to the Lazy loading of the Entity classes.
The reason was that the queries were not optimized.
Now I have the following problem, every time I try to inspect the variables in debug mode, the Designer is throwing errors and it is almost impossible for debugging:&lt;/p&gt;
&lt;p&gt;&lt;img alt="alt text" src="http://answers.axonivy.com/upfiles/Capture_JJL7IfL.JPG"&gt;&lt;/p&gt;
&lt;p&gt;Best Regards,
Yordan Yunchov&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/2311/eager-loading" rel="self"></atom:link><language>en</language><lastBuildDate>Thu, 19 Jan 2017 12:28:40 -0500</lastBuildDate><item><title>Comment by Flavio Sadeghi on Flavio Sadeghi's answer</title><link>https://answers.axonivy.com/questions/2311/eager-loading#2386</link><description>&lt;p&gt;We can fix it for 6.0. (6.1 not, since it is a Leading Edge version) Would this help?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Flavio Sadeghi</dc:creator><pubDate>Thu, 19 Jan 2017 12:28:40 -0500</pubDate><guid>https://answers.axonivy.com/questions/2311/eager-loading#2386</guid></item><item><title>Comment by Stelt0 on Flavio Sadeghi's answer</title><link>https://answers.axonivy.com/questions/2311/eager-loading#2385</link><description>&lt;p&gt;Thanks a lot Flavio !
is it possible to provide some hot-fix jar(s) that will work with older versions 6.0. and 6.1 ?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Stelt0</dc:creator><pubDate>Thu, 19 Jan 2017 12:25:19 -0500</pubDate><guid>https://answers.axonivy.com/questions/2311/eager-loading#2385</guid></item><item><title>Comment by Flavio Sadeghi on Flavio Sadeghi's answer</title><link>https://answers.axonivy.com/questions/2311/eager-loading#2382</link><description>&lt;p&gt;&lt;a href="http://answers.axonivy.com/users/626/stelt0"&gt;&lt;a href="http://answers.axonivy.com/users/626/stelt0"&gt;@Stelt0&lt;/a&gt;&lt;/a&gt;, We have fixed this bug for 6.5, which will be released very soon (probably tomorrow).&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Flavio Sadeghi</dc:creator><pubDate>Thu, 19 Jan 2017 09:39:53 -0500</pubDate><guid>https://answers.axonivy.com/questions/2311/eager-loading#2382</guid></item><item><title>Comment by Stelt0 on Flavio Sadeghi's answer</title><link>https://answers.axonivy.com/questions/2311/eager-loading#2319</link><description>&lt;p&gt;Thanks a lot for addressing this issue ! 
Good luck ! :)&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Stelt0</dc:creator><pubDate>Thu, 22 Dec 2016 10:05:00 -0500</pubDate><guid>https://answers.axonivy.com/questions/2311/eager-loading#2319</guid></item><item><title>Comment by Flavio Sadeghi on Flavio Sadeghi's answer</title><link>https://answers.axonivy.com/questions/2311/eager-loading#2318</link><description>&lt;p&gt;Thanks for feedback. I will check that. Probably the debugview can not handle java proxy objects, which are ordinarily used when working with lazy-loading. We can/will fix that. You will hear from me here.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Flavio Sadeghi</dc:creator><pubDate>Thu, 22 Dec 2016 10:00:08 -0500</pubDate><guid>https://answers.axonivy.com/questions/2311/eager-loading#2318</guid></item><item><title>Comment by Stelt0 on Flavio Sadeghi's answer</title><link>https://answers.axonivy.com/questions/2311/eager-loading#2316</link><description>&lt;p&gt;Hello &lt;a href="http://answers.axonivy.com/users/21/flavio-sadeghi"&gt;&lt;a href="http://answers.axonivy.com/users/21/flavio-sadeghi"&gt;@Flavio Sadeghi&lt;/a&gt;&lt;/a&gt;,&lt;/p&gt;
&lt;p&gt;I agree about what you said.&lt;/p&gt;
&lt;p&gt;However, from the perspective of an user, if I can inspect the variables in Debug mode, why I can't inspect them in Ivy designer process development mode? There is always a error thrown.
For me it is a product bug. And it is a big one. 
Why throwing and error ? Why not showing null or whatever ?
I am not able to inspect the rest of the "unmanaged" variables as well. No mater where I click I get an error.
Best Regards,
Yordan&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Stelt0</dc:creator><pubDate>Thu, 22 Dec 2016 09:31:21 -0500</pubDate><guid>https://answers.axonivy.com/questions/2311/eager-loading#2316</guid></item><item><title>Answer by Flavio Sadeghi</title><link>https://answers.axonivy.com/questions/2311/eager-loading/2314</link><description>&lt;p&gt;&lt;em&gt;[Edit]: The Bug 'Label Job has encountered a problem' is fixed with 6.5. We return null, since the below explanation is still true.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Lazy evaluation of entity beans is not supported with the ivy persistency. &lt;/p&gt;
&lt;p&gt;As described in the documentation, &lt;strong&gt;ivy persistency always works with unmanaged entity beans&lt;/strong&gt;. Lazy loading is only supported with managed entity beans. A beans is managed as long the referenced session (link to the db/transaction) is open - means the entity is managed (i.e. cached) in the session.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How to solve:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Example: Table Company has a 1:n relation to Invoices. &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;First question: is the lazy loading required? Do the Company entity need a list of all invoices or can it be replaced/reduced to the @ManyToOne relation on the Invoice entity? &lt;br&gt;To get the list of all invoices of a company a repositoy method has to be implemented, e.g. &lt;code&gt;InvoiceRepository.readAllOfCompany(Company c) : List&amp;lt; Invoices &amp;gt;;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Write own repository method and open/close the session inside this method. As long the session is open, as long the entiries are managed and lazy loading is supported. Always ensure with a try-finally block that the session gets closed. Otherwise, the connection to the database remains open and the allowed number of connections is limited. An example could be find &lt;a href="http://answers.axonivy.com/questions/1102/how-to-use-jpa-entity-manager-instead-of-ivy-entity-manager"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Flavio Sadeghi</dc:creator><pubDate>Wed, 21 Dec 2016 15:49:08 -0500</pubDate><guid>https://answers.axonivy.com/questions/2311/eager-loading/2314</guid></item></channel></rss>