<?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></description>
	<lastBuildDate>Thu, 18 Mar 2010 13:27:36 +0100</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<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-page-1/#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-page-1/#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-page-1/#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-page-1/#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-page-1/#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-page-1/#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-page-1/#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>
	<item>
		<title>By: koensen</title>
		<link>http://blog.xebia.com/2008/03/08/advanced-hibernate-proxy-pitfalls/comment-page-1/#comment-42308</link>
		<dc:creator>koensen</dc:creator>
		<pubDate>Wed, 16 Apr 2008 15:57:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/2008/03/08/advanced-hibernate-proxy-pitfalls/#comment-42308</guid>
		<description>Actually there are some architectural problems resulting from pitfall 2.
There are some cases where you don&#039;t want to expose a (visible) setter which could initialize the object...
Read here:
http://www.bb242.de/2008/04/02/how-to-live-with-hibernate-proxies/

A pretty neat workaround some things is to work with get() instead of load().</description>
		<content:encoded><![CDATA[<p>Actually there are some architectural problems resulting from pitfall 2.<br />
There are some cases where you don&#8217;t want to expose a (visible) setter which could initialize the object&#8230;<br />
Read here:<br />
<a href="http://www.bb242.de/2008/04/02/how-to-live-with-hibernate-proxies/" rel="nofollow">http://www.bb242.de/2008/04/02/how-to-live-with-hibernate-proxies/</a></p>
<p>A pretty neat workaround some things is to work with get() instead of load().</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cédric Thiébault</title>
		<link>http://blog.xebia.com/2008/03/08/advanced-hibernate-proxy-pitfalls/comment-page-1/#comment-39739</link>
		<dc:creator>Cédric Thiébault</dc:creator>
		<pubDate>Wed, 26 Mar 2008 16:15:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/2008/03/08/advanced-hibernate-proxy-pitfalls/#comment-39739</guid>
		<description>To know the class of the proxy object, you can use the method
Class getClassWithoutInitializingProxy(Object object) 
form 
org.hibernate.proxy.HibernateProxyHelper
/**
 * Get the class of an instance or the underlying class
 * of a proxy (without initializing the proxy!). It is
 * almost always better to use the entity name!
 */</description>
		<content:encoded><![CDATA[<p>To know the class of the proxy object, you can use the method<br />
Class getClassWithoutInitializingProxy(Object object)<br />
form<br />
org.hibernate.proxy.HibernateProxyHelper<br />
/**<br />
 * Get the class of an instance or the underlying class<br />
 * of a proxy (without initializing the proxy!). It is<br />
 * almost always better to use the entity name!<br />
 */</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Medhat Saleh</title>
		<link>http://blog.xebia.com/2008/03/08/advanced-hibernate-proxy-pitfalls/comment-page-1/#comment-37370</link>
		<dc:creator>Medhat Saleh</dc:creator>
		<pubDate>Tue, 11 Mar 2008 01:05:10 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/2008/03/08/advanced-hibernate-proxy-pitfalls/#comment-37370</guid>
		<description>Thanks a lot for these two. I was bitten before by the second one and could not figure out how to solve cleanly as you are suggesting, so I ended up with a very nasty hack in the domain code.</description>
		<content:encoded><![CDATA[<p>Thanks a lot for these two. I was bitten before by the second one and could not figure out how to solve cleanly as you are suggesting, so I ended up with a very nasty hack in the domain code.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
