<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Advanced Hibernate: Proxy Pitfalls</title>
	<atom:link href="http://blog.xebia.com/2008/03/08/advanced-hibernate-proxy-pitfalls/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.xebia.com/2008/03/08/advanced-hibernate-proxy-pitfalls/</link>
	<description>Software development done right!</description>
	<lastBuildDate>Wed, 08 Feb 2012 14:41:38 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Stephane</title>
		<link>http://blog.xebia.com/2008/03/08/advanced-hibernate-proxy-pitfalls/#comment-114887</link>
		<dc:creator>Stephane</dc:creator>
		<pubDate>Thu, 08 Dec 2011 15:45:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/2008/03/08/advanced-hibernate-proxy-pitfalls/#comment-114887</guid>
		<description>Nice article. Thanks for that. Just a little spelling mistake: thr proxy</description>
		<content:encoded><![CDATA[<p>Nice article. Thanks for that. Just a little spelling mistake: thr proxy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephane</title>
		<link>http://blog.xebia.com/2008/03/08/advanced-hibernate-proxy-pitfalls/#comment-113558</link>
		<dc:creator>Stephane</dc:creator>
		<pubDate>Sun, 20 Nov 2011 18:33:33 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/2008/03/08/advanced-hibernate-proxy-pitfalls/#comment-113558</guid>
		<description>Hello,

I have a similar issue I guess, related to the proxy mechanism I suspect.

It is described on the Hibernate forum.

I wonder if any of you guys would see something interesting in it.

https://forum.hibernate.org/viewtopic.php?f=1&amp;t=1011804

Thanks !

Stephane</description>
		<content:encoded><![CDATA[<p>Hello,</p>
<p>I have a similar issue I guess, related to the proxy mechanism I suspect.</p>
<p>It is described on the Hibernate forum.</p>
<p>I wonder if any of you guys would see something interesting in it.</p>
<p><a href="https://forum.hibernate.org/viewtopic.php?f=1&#038;t=1011804" rel="nofollow">https://forum.hibernate.org/viewtopic.php?f=1&#038;t=1011804</a></p>
<p>Thanks !</p>
<p>Stephane</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sean van Buggenum</title>
		<link>http://blog.xebia.com/2008/03/08/advanced-hibernate-proxy-pitfalls/#comment-96444</link>
		<dc:creator>Sean van Buggenum</dc:creator>
		<pubDate>Tue, 14 Sep 2010 02:25:22 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/2008/03/08/advanced-hibernate-proxy-pitfalls/#comment-96444</guid>
		<description>Hi all, 

I am just now revisiting hibernate, and came across this great, helpful blog. Thanks.

However, I do have a question. I know this was written 2 years ago, but I hope someone can anyway clear this up for me. 

I would like to question &quot;Proxy Pitfall 2: instanceOf&quot;.

When one has a class A, 
and a class B extends A, 

one can correctly assert the following:

A aObj = new A();
B bObj = new B();

assertTrue(aobj instanceof A &amp;&amp; bObj instanceof A);

This should pass, because while bObj is not an exact instance of class A, the operator &#039;instanceof&#039; evaluates as true of an object is an instance of the specified class OR an instance of a subclass of the specified class.

So, in other words, the &#039;instanceof&#039; operator causes no problems in testing that an object (which is probably a proxy object) is an instance of the derived class, because it will be. 

So, given this is true, can I assume that the problem mentioned here is more a problem of testing exactly that an object is of a the exact class A (through testing class equals ) ?

for example:

bObj.getClass().equals(A.class)  

which will indeed fail.</description>
		<content:encoded><![CDATA[<p>Hi all, </p>
<p>I am just now revisiting hibernate, and came across this great, helpful blog. Thanks.</p>
<p>However, I do have a question. I know this was written 2 years ago, but I hope someone can anyway clear this up for me. </p>
<p>I would like to question &#8220;Proxy Pitfall 2: instanceOf&#8221;.</p>
<p>When one has a class A,<br />
and a class B extends A, </p>
<p>one can correctly assert the following:</p>
<p>A aObj = new A();<br />
B bObj = new B();</p>
<p>assertTrue(aobj instanceof A &amp;&amp; bObj instanceof A);</p>
<p>This should pass, because while bObj is not an exact instance of class A, the operator &#8216;instanceof&#8217; evaluates as true of an object is an instance of the specified class OR an instance of a subclass of the specified class.</p>
<p>So, in other words, the &#8216;instanceof&#8217; operator causes no problems in testing that an object (which is probably a proxy object) is an instance of the derived class, because it will be. </p>
<p>So, given this is true, can I assume that the problem mentioned here is more a problem of testing exactly that an object is of a the exact class A (through testing class equals ) ?</p>
<p>for example:</p>
<p>bObj.getClass().equals(A.class)  </p>
<p>which will indeed fail.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Laziness (in proxies) is a virtue &#124; Redfin Developers&#8217; Blog</title>
		<link>http://blog.xebia.com/2008/03/08/advanced-hibernate-proxy-pitfalls/#comment-93683</link>
		<dc:creator>Laziness (in proxies) is a virtue &#124; Redfin Developers&#8217; Blog</dc:creator>
		<pubDate>Tue, 29 Dec 2009 17:51:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/2008/03/08/advanced-hibernate-proxy-pitfalls/#comment-93683</guid>
		<description>[...] the lazy proxy is NOT the same as the actual object. If you depend on the datatype of the object, you may have problems, since the type of the proxy isn&#8217;t the same as the type of the actual object (e.g. a proxy [...]</description>
		<content:encoded><![CDATA[<p>[...] the lazy proxy is NOT the same as the actual object. If you depend on the datatype of the object, you may have problems, since the type of the proxy isn&#8217;t the same as the type of the actual object (e.g. a proxy [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: donamir</title>
		<link>http://blog.xebia.com/2008/03/08/advanced-hibernate-proxy-pitfalls/#comment-92879</link>
		<dc:creator>donamir</dc:creator>
		<pubDate>Wed, 21 Oct 2009 10:12:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/2008/03/08/advanced-hibernate-proxy-pitfalls/#comment-92879</guid>
		<description>Useful article, tanks.</description>
		<content:encoded><![CDATA[<p>Useful article, tanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JPA implementation patterns: Lazy loading &#124; Xebia Blog</title>
		<link>http://blog.xebia.com/2008/03/08/advanced-hibernate-proxy-pitfalls/#comment-91629</link>
		<dc:creator>JPA implementation patterns: Lazy loading &#124; Xebia Blog</dc:creator>
		<pubDate>Mon, 27 Apr 2009 19:30:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/2008/03/08/advanced-hibernate-proxy-pitfalls/#comment-91629</guid>
		<description>[...] when invoking the identifier getter method. My colleague Maarten Winkels has blogged about the pitfalls of these Hibernate proxies last [...]</description>
		<content:encoded><![CDATA[<p>[...] when invoking the identifier getter method. My colleague Maarten Winkels has blogged about the pitfalls of these Hibernate proxies last [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pravin</title>
		<link>http://blog.xebia.com/2008/03/08/advanced-hibernate-proxy-pitfalls/#comment-66335</link>
		<dc:creator>Pravin</dc:creator>
		<pubDate>Thu, 04 Dec 2008 10:51:49 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/2008/03/08/advanced-hibernate-proxy-pitfalls/#comment-66335</guid>
		<description>Hi I am having problem with same with proxy i want to check whether it is the instance of a class out of two classes as the object is of Base class Like: C is base class and A,B are derived so i want to check whether new C() instanceof A or B.

Please help me 

Pravin</description>
		<content:encoded><![CDATA[<p>Hi I am having problem with same with proxy i want to check whether it is the instance of a class out of two classes as the object is of Base class Like: C is base class and A,B are derived so i want to check whether new C() instanceof A or B.</p>
<p>Please help me </p>
<p>Pravin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frits Jalvingh</title>
		<link>http://blog.xebia.com/2008/03/08/advanced-hibernate-proxy-pitfalls/#comment-54474</link>
		<dc:creator>Frits Jalvingh</dc:creator>
		<pubDate>Thu, 25 Sep 2008 12:27:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/2008/03/08/advanced-hibernate-proxy-pitfalls/#comment-54474</guid>
		<description>@Christian:
Bytecode-enhancing the actual class would be great but in runtime is hard to do because they need to be enhanced before they are ever used which is complex.

A simpler alternative is to create a proxy for the actual object itself and *not* have the &quot;target&quot; kludge. Simply use the fields in the proxy directly. This still does not properly solve the inheritance scheme but that is impossible with lazy loading anyway.

The simpler alternative has way less problems than the current implementation and *can* be built in an afternoon (my replacement for Hibernate called SPF has it, and it took that long ;-)

Sadly, Hibernate sucks bigtime and is not a good persistence framework at all; it is just the one that sucks the least...</description>
		<content:encoded><![CDATA[<p>@Christian:<br />
Bytecode-enhancing the actual class would be great but in runtime is hard to do because they need to be enhanced before they are ever used which is complex.</p>
<p>A simpler alternative is to create a proxy for the actual object itself and *not* have the &#8220;target&#8221; kludge. Simply use the fields in the proxy directly. This still does not properly solve the inheritance scheme but that is impossible with lazy loading anyway.</p>
<p>The simpler alternative has way less problems than the current implementation and *can* be built in an afternoon (my replacement for Hibernate called SPF has it, and it took that long <img src='http://blog.xebia.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Sadly, Hibernate sucks bigtime and is not a good persistence framework at all; it is just the one that sucks the least&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christian</title>
		<link>http://blog.xebia.com/2008/03/08/advanced-hibernate-proxy-pitfalls/#comment-45076</link>
		<dc:creator>Christian</dc:creator>
		<pubDate>Mon, 09 Jun 2008 09:47:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/2008/03/08/advanced-hibernate-proxy-pitfalls/#comment-45076</guid>
		<description>my &lt; and &gt; got lost, it should read:
&lt;sarcasm&gt;Hey, its the world best ORM and everything else is crap&lt;/sarcasm&gt;</description>
		<content:encoded><![CDATA[<p>my &lt; and &gt; got lost, it should read:<br />
&lt;sarcasm&gt;Hey, its the world best ORM and everything else is crap&lt;/sarcasm&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christian</title>
		<link>http://blog.xebia.com/2008/03/08/advanced-hibernate-proxy-pitfalls/#comment-45075</link>
		<dc:creator>Christian</dc:creator>
		<pubDate>Mon, 09 Jun 2008 09:46:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/2008/03/08/advanced-hibernate-proxy-pitfalls/#comment-45075</guid>
		<description>my 2 cents:
pitfall #2 is just a design/implementation bug, where Hibernate has never admitted, that it is a bug Hey, its the world best ORM and everything else is crap

The JPA spec has addressed this: 2.1.7. ...Relationships are polymorphic.
Nothing more to say, except that it sometimes does still occur in Hibernates JPA implementation (but now its a bug, not a feature)

Regarding Proxies in general: The Hibernate approach is the we-can-implement-it-on-a-weekend approach. Whereas JDO has featured a smarter approach (available in many JPA implementations), i.e. use byte code enhancement to implement the proxy functionality in the class itself, which solves most of the problems. (But you can&#039;t design and implement that on a weekend.)

Christian</description>
		<content:encoded><![CDATA[<p>my 2 cents:<br />
pitfall #2 is just a design/implementation bug, where Hibernate has never admitted, that it is a bug Hey, its the world best ORM and everything else is crap</p>
<p>The JPA spec has addressed this: 2.1.7. &#8230;Relationships are polymorphic.<br />
Nothing more to say, except that it sometimes does still occur in Hibernates JPA implementation (but now its a bug, not a feature)</p>
<p>Regarding Proxies in general: The Hibernate approach is the we-can-implement-it-on-a-weekend approach. Whereas JDO has featured a smarter approach (available in many JPA implementations), i.e. use byte code enhancement to implement the proxy functionality in the class itself, which solves most of the problems. (But you can&#8217;t design and implement that on a weekend.)</p>
<p>Christian</p>
]]></content:encoded>
	</item>
</channel>
</rss>
<!-- This Quick Cache file was built for (  blog.xebia.com/2008/03/08/advanced-hibernate-proxy-pitfalls/feed/ ) in 0.54335 seconds, on Feb 9th, 2012 at 7:33 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 9th, 2012 at 8:33 pm UTC -->
