<?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"
	>
<channel>
	<title>Comments on: Hibernate pitfalls part 1</title>
	<atom:link href="http://brian.pontarelli.com/2007/04/02/why-hibernate-sucks-part-1/feed/" rel="self" type="application/rss+xml" />
	<link>http://brian.pontarelli.com/2007/04/02/why-hibernate-sucks-part-1/</link>
	<description>Brian Pontarelli</description>
	<pubDate>Wed, 07 Jan 2009 04:47:37 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
		<item>
		<title>By: Qiang</title>
		<link>http://brian.pontarelli.com/2007/04/02/why-hibernate-sucks-part-1/#comment-30374</link>
		<dc:creator>Qiang</dc:creator>
		<pubDate>Fri, 22 Aug 2008 17:55:10 +0000</pubDate>
		<guid isPermaLink="false">http://brian.pontarelli.com/2007/04/02/why-hibernate-sucks-part-1/#comment-30374</guid>
		<description>I tried to like hibernate but I finally gave up. It was really a painful to use it in my projects. The main reason I think it is too intrusive. It dictates the way you design your application. It blurs the boundary between database and applications. Database schema inevitably leaks into application's data model. The result is, if you change either data model or database schema, you have to change the other. And because hibernate's hbm is so complicated, changing database schema will make it painful to update the hbms. At last, Hibernate has too many caveats. You have to be very careful when writing beans for hibernate.

Instead, I found it was a pleasure  to use iBatis as I had full controls over SQLs and my code was much more concise.</description>
		<content:encoded><![CDATA[<p>I tried to like hibernate but I finally gave up. It was really a painful to use it in my projects. The main reason I think it is too intrusive. It dictates the way you design your application. It blurs the boundary between database and applications. Database schema inevitably leaks into application&#8217;s data model. The result is, if you change either data model or database schema, you have to change the other. And because hibernate&#8217;s hbm is so complicated, changing database schema will make it painful to update the hbms. At last, Hibernate has too many caveats. You have to be very careful when writing beans for hibernate.</p>
<p>Instead, I found it was a pleasure  to use iBatis as I had full controls over SQLs and my code was much more concise.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Raveendran</title>
		<link>http://brian.pontarelli.com/2007/04/02/why-hibernate-sucks-part-1/#comment-21230</link>
		<dc:creator>Raveendran</dc:creator>
		<pubDate>Mon, 23 Jun 2008 18:37:55 +0000</pubDate>
		<guid isPermaLink="false">http://brian.pontarelli.com/2007/04/02/why-hibernate-sucks-part-1/#comment-21230</guid>
		<description>I think, the points discussed here are worthwhile. I don't know if hibernate is good or not but I was trying out something simple like this

			HibernateTemplate ht = getHibernateTemplate();
			ht.save( b );
			ht.flush();

and this resulted in all those mysterious errors that the article talks about.

I would definitely not prefer Hibernate over simple C++ or over the great ORM capabilities of Ruby on Rails. At least we have complete control of the exceptions and errors in the case of C++ or RoR. That way hibernate sucks, not even a good post in net for this problem from the Hibernate team and above all the team tries to defend themselves for their follies.</description>
		<content:encoded><![CDATA[<p>I think, the points discussed here are worthwhile. I don&#8217;t know if hibernate is good or not but I was trying out something simple like this</p>
<p>			HibernateTemplate ht = getHibernateTemplate();<br />
			ht.save( b );<br />
			ht.flush();</p>
<p>and this resulted in all those mysterious errors that the article talks about.</p>
<p>I would definitely not prefer Hibernate over simple C++ or over the great ORM capabilities of Ruby on Rails. At least we have complete control of the exceptions and errors in the case of C++ or RoR. That way hibernate sucks, not even a good post in net for this problem from the Hibernate team and above all the team tries to defend themselves for their follies.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Newman</title>
		<link>http://brian.pontarelli.com/2007/04/02/why-hibernate-sucks-part-1/#comment-16914</link>
		<dc:creator>John Newman</dc:creator>
		<pubDate>Thu, 15 May 2008 21:45:13 +0000</pubDate>
		<guid isPermaLink="false">http://brian.pontarelli.com/2007/04/02/why-hibernate-sucks-part-1/#comment-16914</guid>
		<description>"Hibernate sucks because I don't understand anything about transaction boundaries"

hibernate is good stuff if you aren't too lazy/incompetent to figure it out.  Spring's hibernate template &#38; hibernate transaction manager are a big help.</description>
		<content:encoded><![CDATA[<p>&#8220;Hibernate sucks because I don&#8217;t understand anything about transaction boundaries&#8221;</p>
<p>hibernate is good stuff if you aren&#8217;t too lazy/incompetent to figure it out.  Spring&#8217;s hibernate template &amp; hibernate transaction manager are a big help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jiang</title>
		<link>http://brian.pontarelli.com/2007/04/02/why-hibernate-sucks-part-1/#comment-6368</link>
		<dc:creator>Jiang</dc:creator>
		<pubDate>Sun, 30 Dec 2007 01:31:01 +0000</pubDate>
		<guid isPermaLink="false">http://brian.pontarelli.com/2007/04/02/why-hibernate-sucks-part-1/#comment-6368</guid>
		<description>In my view, Hibernate is for people who don't know or don't want to invest time in writing performant SQL queries.  Maintain and convert a Hibernate project is very painful in that you have no idea how the queries are executed.</description>
		<content:encoded><![CDATA[<p>In my view, Hibernate is for people who don&#8217;t know or don&#8217;t want to invest time in writing performant SQL queries.  Maintain and convert a Hibernate project is very painful in that you have no idea how the queries are executed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rajeev Jha</title>
		<link>http://brian.pontarelli.com/2007/04/02/why-hibernate-sucks-part-1/#comment-5581</link>
		<dc:creator>Rajeev Jha</dc:creator>
		<pubDate>Tue, 04 Dec 2007 10:45:39 +0000</pubDate>
		<guid isPermaLink="false">http://brian.pontarelli.com/2007/04/02/why-hibernate-sucks-part-1/#comment-5581</guid>
		<description>I have used hibernate and frankly there are few hidden monsters. Best of all the documentation is good and normally you get answers to all the questions. I would consider write-behind to be a feature and not an *issue*</description>
		<content:encoded><![CDATA[<p>I have used hibernate and frankly there are few hidden monsters. Best of all the documentation is good and normally you get answers to all the questions. I would consider write-behind to be a feature and not an *issue*</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arvind Kumar</title>
		<link>http://brian.pontarelli.com/2007/04/02/why-hibernate-sucks-part-1/#comment-3976</link>
		<dc:creator>Arvind Kumar</dc:creator>
		<pubDate>Sat, 07 Jul 2007 08:22:11 +0000</pubDate>
		<guid isPermaLink="false">http://brian.pontarelli.com/2007/04/02/why-hibernate-sucks-part-1/#comment-3976</guid>
		<description>Nonsense or Not, this article ( part 2 and 3 as well) helped us in our project where we were not considering the flush() much.  I think people at hibernate.org should come out with some standard list of mistakes or misconceptions that a consultant/contractor/developer can have.</description>
		<content:encoded><![CDATA[<p>Nonsense or Not, this article ( part 2 and 3 as well) helped us in our project where we were not considering the flush() much.  I think people at hibernate.org should come out with some standard list of mistakes or misconceptions that a consultant/contractor/developer can have.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter D</title>
		<link>http://brian.pontarelli.com/2007/04/02/why-hibernate-sucks-part-1/#comment-3931</link>
		<dc:creator>Peter D</dc:creator>
		<pubDate>Mon, 02 Jul 2007 23:03:30 +0000</pubDate>
		<guid isPermaLink="false">http://brian.pontarelli.com/2007/04/02/why-hibernate-sucks-part-1/#comment-3931</guid>
		<description>Mark -- I don't know if this is a proper answer to your question but here's something I ran into today ... we are converting data from a legacy system into a new system with business objects persisted with hibernate. The query against the old table, also H defined, returns 26,000 objects ... everything is running really slowly. 80 seconds to process 100 entries. Queries are taking forever. CPU is running 50% and the db is hardly working up a sweat. The solution? Clear the Hibernate cache immediately after the query bringing in the old table's objects and clear it every 100 entries written to the DB. Now it takes 8 seconds to process 100 records. The problem is I would have expected H to just take care of this for me. It is not obvious (to me) that this needs to be done. 

I don't necessarily agree with the thrust of this post but I think it and its replies are quite educational; so thanks to the author for writing it.</description>
		<content:encoded><![CDATA[<p>Mark &#8212; I don&#8217;t know if this is a proper answer to your question but here&#8217;s something I ran into today &#8230; we are converting data from a legacy system into a new system with business objects persisted with hibernate. The query against the old table, also H defined, returns 26,000 objects &#8230; everything is running really slowly. 80 seconds to process 100 entries. Queries are taking forever. CPU is running 50% and the db is hardly working up a sweat. The solution? Clear the Hibernate cache immediately after the query bringing in the old table&#8217;s objects and clear it every 100 entries written to the DB. Now it takes 8 seconds to process 100 records. The problem is I would have expected H to just take care of this for me. It is not obvious (to me) that this needs to be done. </p>
<p>I don&#8217;t necessarily agree with the thrust of this post but I think it and its replies are quite educational; so thanks to the author for writing it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mark</title>
		<link>http://brian.pontarelli.com/2007/04/02/why-hibernate-sucks-part-1/#comment-3685</link>
		<dc:creator>mark</dc:creator>
		<pubDate>Tue, 15 May 2007 05:00:32 +0000</pubDate>
		<guid isPermaLink="false">http://brian.pontarelli.com/2007/04/02/why-hibernate-sucks-part-1/#comment-3685</guid>
		<description>Is this statement true????

"Debugging is tough and error handling in hibernate leaves a lot to be desired. If you make mistakes or have a complex database, hooking up hibernate can be a nightmare and cause your project to go way over budget.
"</description>
		<content:encoded><![CDATA[<p>Is this statement true????</p>
<p>&#8220;Debugging is tough and error handling in hibernate leaves a lot to be desired. If you make mistakes or have a complex database, hooking up hibernate can be a nightmare and cause your project to go way over budget.<br />
&#8220;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob Bygrave</title>
		<link>http://brian.pontarelli.com/2007/04/02/why-hibernate-sucks-part-1/#comment-3492</link>
		<dc:creator>Rob Bygrave</dc:creator>
		<pubDate>Thu, 12 Apr 2007 10:51:37 +0000</pubDate>
		<guid isPermaLink="false">http://brian.pontarelli.com/2007/04/02/why-hibernate-sucks-part-1/#comment-3492</guid>
		<description>Perhaps this is slightly off topic, but in I'd like to see how this relates to JPA as well (as opposed to just Hibernate).   

The way I see it, this example shows what I consider 3 specific issues with JPA (as it currently stands). Specifically I would personally like to see JPA provide more control to developers in 3 areas.

1. Control over Statement Batching (on/off, batch size, generated keys)
2. Control over Cascading of Persist/Delete (the ability to turn it off)
3. Better support for using Raw JDBC Support

The example here as I see it revolves around the 'transparent batching' that is occurring (until the 'flush' in this example). As I see it there is nothing in JPA that allows you to control the statement batching - It may be that vendors do not see your pain? 

Another weakness in JPA (as I see it) is the lack of support for getting the Connection and using it (for more advanced uses such as stored proc calls, savepoints etc). Normally a query would implicitly flush (in JPA, Hibernate and Ebean) but raw use of Connection is not supported in JPA (currently).

Disclaimer: I've created Ebean at www.avaje.org to try and improve JPA (and simplify life).</description>
		<content:encoded><![CDATA[<p>Perhaps this is slightly off topic, but in I&#8217;d like to see how this relates to JPA as well (as opposed to just Hibernate).   </p>
<p>The way I see it, this example shows what I consider 3 specific issues with JPA (as it currently stands). Specifically I would personally like to see JPA provide more control to developers in 3 areas.</p>
<p>1. Control over Statement Batching (on/off, batch size, generated keys)<br />
2. Control over Cascading of Persist/Delete (the ability to turn it off)<br />
3. Better support for using Raw JDBC Support</p>
<p>The example here as I see it revolves around the &#8216;transparent batching&#8217; that is occurring (until the &#8216;flush&#8217; in this example). As I see it there is nothing in JPA that allows you to control the statement batching - It may be that vendors do not see your pain? </p>
<p>Another weakness in JPA (as I see it) is the lack of support for getting the Connection and using it (for more advanced uses such as stored proc calls, savepoints etc). Normally a query would implicitly flush (in JPA, Hibernate and Ebean) but raw use of Connection is not supported in JPA (currently).</p>
<p>Disclaimer: I&#8217;ve created Ebean at <a href="http://www.avaje.org" rel="nofollow">http://www.avaje.org</a> to try and improve JPA (and simplify life).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Pontarelli</title>
		<link>http://brian.pontarelli.com/2007/04/02/why-hibernate-sucks-part-1/#comment-3477</link>
		<dc:creator>Brian Pontarelli</dc:creator>
		<pubDate>Tue, 10 Apr 2007 17:01:29 +0000</pubDate>
		<guid isPermaLink="false">http://brian.pontarelli.com/2007/04/02/why-hibernate-sucks-part-1/#comment-3477</guid>
		<description>&lt;blockquote&gt;
The problem here is that this example is running into some side effects of CMT (container managed transactions). Hibernate is working *correctly*. In fact, flush() is limited in when it can force a database commit. Itâ€™s limited by the containerâ€™s transaction boundary.
&lt;/blockquote&gt;

This code was actually run command line without any container. Hibernate batches all database activity until a transaction boundary is hit and this is the pitfall I describe here. You just have to know this and plan for it.</description>
		<content:encoded><![CDATA[<blockquote><p>
The problem here is that this example is running into some side effects of CMT (container managed transactions). Hibernate is working *correctly*. In fact, flush() is limited in when it can force a database commit. Itâ€™s limited by the containerâ€™s transaction boundary.
</p></blockquote>
<p>This code was actually run command line without any container. Hibernate batches all database activity until a transaction boundary is hit and this is the pitfall I describe here. You just have to know this and plan for it.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
