<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Dobesland - Latest Comments in Hibernate + fetch=FetchType.LAZY making trouble | Dobesland</title><link>http://dobesland.disqus.com/</link><description>Dobes Vandermeer's blog - software engineering, java programming, enlightenment</description><atom:link href="https://dobesland.disqus.com/hibernate_fetchfetchtypelazy_making_trouble_dobesland/latest.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Mon, 07 Jan 2008 13:09:09 -0000</lastBuildDate><item><title>Re: Hibernate + fetch=FetchType.LAZY making trouble | Dobesland</title><link>http://www.dobesland.com/2008/01/06/hibernate-fetchfetchtypelazy-making-trouble/#comment-2814300</link><description>&lt;p&gt;Yeah, I'm in a transaction - it's one EJB using another one.  I'm using reflection to fetch properties of an entity and comparing them using equals() and, for whatever reason, equals() returned false when I compared an object to itself!  Weird!&lt;/p&gt;&lt;p&gt;During debugging, I saw that the object was a lazy proxy, and that it was not loaded, so I changed FetchType.LAZY to FetchType.EAGER and suddenly it worked!&lt;/p&gt;&lt;p&gt;I made sure my equals() method wasn't accessing members directly - it was using getter methods.  So, I have no idea why this was not working this way.&lt;/p&gt;&lt;p&gt;Some kind of issue with accessing members with reflection?  Or something else?&lt;/p&gt;&lt;p&gt;I guess I just don't feel like I have time to debug these weird hibernate behaviors when I can just not use lazy fields.&lt;/p&gt;&lt;p&gt;After making this post, though, I did switch some of my inverse relationships back to LAZY because they were causing all kinds of extra things to be fetched that I didn't need... hopefully I won't get burned by that too soon.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">dobes</dc:creator><pubDate>Mon, 07 Jan 2008 13:09:09 -0000</pubDate></item><item><title>Re: Hibernate + fetch=FetchType.LAZY making trouble | Dobesland</title><link>http://www.dobesland.com/2008/01/06/hibernate-fetchfetchtypelazy-making-trouble/#comment-2814299</link><description>&lt;p&gt;Are you sure you did not close or clear the session or transaction before try to navigate your lazy object ? This is usually the typical trouble with lazy objects I also encountered with when first using HIbernate. In case of pure EJB (JPA), you can get the same behavior when returning lazy object as a result of EJB bean method.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Dmitri Livotov</dc:creator><pubDate>Mon, 07 Jan 2008 05:24:47 -0000</pubDate></item></channel></rss>