<?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: Before a JDBC operation, flush the Hibernate Session (includes TSE example code)</title>
	<atom:link href="http://blog.springsource.com/2008/01/04/before-a-jdbc-operation-flush-the-hibernate-session-includes-tse-example-code/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.springsource.com/2008/01/04/before-a-jdbc-operation-flush-the-hibernate-session-includes-tse-example-code/</link>
	<description>The voice of SpringSource</description>
	<pubDate>Mon, 13 Oct 2008 23:22:23 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<item>
		<title>By: varun</title>
		<link>http://blog.springsource.com/2008/01/04/before-a-jdbc-operation-flush-the-hibernate-session-includes-tse-example-code/#comment-112675</link>
		<dc:creator>varun</dc:creator>
		<pubDate>Fri, 11 Jul 2008 15:16:59 +0000</pubDate>
		<guid isPermaLink="false">http://blog.interface21.com/main/2008/01/04/before-a-jdbc-operation-flush-the-hibernate-session-includes-tse-example-code/#comment-112675</guid>
		<description>Excellent write up and very helpful!</description>
		<content:encoded><![CDATA[<p>Excellent write up and very helpful!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alef Arendsen</title>
		<link>http://blog.springsource.com/2008/01/04/before-a-jdbc-operation-flush-the-hibernate-session-includes-tse-example-code/#comment-99958</link>
		<dc:creator>Alef Arendsen</dc:creator>
		<pubDate>Wed, 05 Mar 2008 11:51:46 +0000</pubDate>
		<guid isPermaLink="false">http://blog.interface21.com/main/2008/01/04/before-a-jdbc-operation-flush-the-hibernate-session-includes-tse-example-code/#comment-99958</guid>
		<description>Sure, no problem! Happy that it cleared things up for you.</description>
		<content:encoded><![CDATA[<p>Sure, no problem! Happy that it cleared things up for you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Archerovic</title>
		<link>http://blog.springsource.com/2008/01/04/before-a-jdbc-operation-flush-the-hibernate-session-includes-tse-example-code/#comment-99954</link>
		<dc:creator>Archerovic</dc:creator>
		<pubDate>Wed, 05 Mar 2008 11:14:23 +0000</pubDate>
		<guid isPermaLink="false">http://blog.interface21.com/main/2008/01/04/before-a-jdbc-operation-flush-the-hibernate-session-includes-tse-example-code/#comment-99954</guid>
		<description>You got a point, same thing I did in our previous project and I thought that was wrong. Sorry for hasty post.

Best regards.</description>
		<content:encoded><![CDATA[<p>You got a point, same thing I did in our previous project and I thought that was wrong. Sorry for hasty post.</p>
<p>Best regards.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alef Arendsen</title>
		<link>http://blog.springsource.com/2008/01/04/before-a-jdbc-operation-flush-the-hibernate-session-includes-tse-example-code/#comment-99897</link>
		<dc:creator>Alef Arendsen</dc:creator>
		<pubDate>Tue, 04 Mar 2008 12:14:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.interface21.com/main/2008/01/04/before-a-jdbc-operation-flush-the-hibernate-session-includes-tse-example-code/#comment-99897</guid>
		<description>&lt;blockquote&gt;Hi, my opinion is that this is totally artificial example, because you can set "stock" of part before even persist it in database.
&lt;/blockquote&gt;

Sure enough, it can be persisted before updating the part in the database. But think about first creating 1.000 parts and then running some kind of stored procedure that touches the same data.

&lt;blockquote&gt;
After all isn't your solution similar to READ_UNCOMMITED isolation level because you want to update data which isn't commited yet.
&lt;/blockquote&gt;

That's not entirely correct. This scenario talks about one and the same transaction. Both the JDBC operation and the Hibernate flushing happen in the same transaction. Because of transactional write-behind, you cannot get to the data that Hibernate will save at the end of the transaction, while logically, you would expect it to be saved already.

So again, one transaction, not two.

&lt;blockquote&gt;
As I know calling of flush() on session is really expensive.
&lt;/blockquote&gt;
Flushing is probably not the most efficient operation, I have to agree. But then again, something that is flushed, doesn't have to be flushed again. Sure enough, it will not enhance performance...</description>
		<content:encoded><![CDATA[<blockquote><p>Hi, my opinion is that this is totally artificial example, because you can set &#034;stock&#034; of part before even persist it in database.
</p></blockquote>
<p>Sure enough, it can be persisted before updating the part in the database. But think about first creating 1.000 parts and then running some kind of stored procedure that touches the same data.</p>
<blockquote><p>
After all isn&#039;t your solution similar to READ_UNCOMMITED isolation level because you want to update data which isn&#039;t commited yet.
</p></blockquote>
<p>That&#039;s not entirely correct. This scenario talks about one and the same transaction. Both the JDBC operation and the Hibernate flushing happen in the same transaction. Because of transactional write-behind, you cannot get to the data that Hibernate will save at the end of the transaction, while logically, you would expect it to be saved already.</p>
<p>So again, one transaction, not two.</p>
<blockquote><p>
As I know calling of flush() on session is really expensive.
</p></blockquote>
<p>Flushing is probably not the most efficient operation, I have to agree. But then again, something that is flushed, doesn&#039;t have to be flushed again. Sure enough, it will not enhance performance&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Archerovic</title>
		<link>http://blog.springsource.com/2008/01/04/before-a-jdbc-operation-flush-the-hibernate-session-includes-tse-example-code/#comment-99893</link>
		<dc:creator>Archerovic</dc:creator>
		<pubDate>Tue, 04 Mar 2008 10:32:07 +0000</pubDate>
		<guid isPermaLink="false">http://blog.interface21.com/main/2008/01/04/before-a-jdbc-operation-flush-the-hibernate-session-includes-tse-example-code/#comment-99893</guid>
		<description>Hi, my opinion is that this is totally artificial example, because you can set "stock" of part before even persist it in database. You must call flush even if you are updating part with Hibernate. After all isn't your solution similar to READ_UNCOMMITED isolation level because you want to update data which isn't commited yet.  As I know calling of flush() on session is really expensive.

In real life I think is better to propagate saving of object as long as it takes and save it at the end of transaction, if you have such requirements.

Correct me if I'm wrong. 

Regards.</description>
		<content:encoded><![CDATA[<p>Hi, my opinion is that this is totally artificial example, because you can set &#034;stock&#034; of part before even persist it in database. You must call flush even if you are updating part with Hibernate. After all isn&#039;t your solution similar to READ_UNCOMMITED isolation level because you want to update data which isn&#039;t commited yet.  As I know calling of flush() on session is really expensive.</p>
<p>In real life I think is better to propagate saving of object as long as it takes and save it at the end of transaction, if you have such requirements.</p>
<p>Correct me if I&#039;m wrong. </p>
<p>Regards.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SpringSource Team Blog &#187; Capturing failures and system state (part I)</title>
		<link>http://blog.springsource.com/2008/01/04/before-a-jdbc-operation-flush-the-hibernate-session-includes-tse-example-code/#comment-85787</link>
		<dc:creator>SpringSource Team Blog &#187; Capturing failures and system state (part I)</dc:creator>
		<pubDate>Mon, 07 Jan 2008 21:17:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.interface21.com/main/2008/01/04/before-a-jdbc-operation-flush-the-hibernate-session-includes-tse-example-code/#comment-85787</guid>
		<description>[...] Posted on January 7th, 2008 by Alef Arendsen in Spring.  At The Spring Experience, I hosted a session various aspects. One of them was the Hibernate synchronization aspect that I described last week. Another was an aspect capable of capturing first failures and system state, sometimes called First-Failure Data Capture (FFDC). I hosted this session to show off some aspects that are very useful, but that people might not have come across in practice yet. I often hear people asking about aspects other than logging, tracing, transaction management and security. The Hibernate synchronization aspect and the FFDC aspect are nice examples I think. [...]</description>
		<content:encoded><![CDATA[<p>[...] Posted on January 7th, 2008 by Alef Arendsen in Spring.  At The Spring Experience, I hosted a session various aspects. One of them was the Hibernate synchronization aspect that I described last week. Another was an aspect capable of capturing first failures and system state, sometimes called First-Failure Data Capture (FFDC). I hosted this session to show off some aspects that are very useful, but that people might not have come across in practice yet. I often hear people asking about aspects other than logging, tracing, transaction management and security. The Hibernate synchronization aspect and the FFDC aspect are nice examples I think. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lenz</title>
		<link>http://blog.springsource.com/2008/01/04/before-a-jdbc-operation-flush-the-hibernate-session-includes-tse-example-code/#comment-85416</link>
		<dc:creator>Lenz</dc:creator>
		<pubDate>Sun, 06 Jan 2008 15:54:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.interface21.com/main/2008/01/04/before-a-jdbc-operation-flush-the-hibernate-session-includes-tse-example-code/#comment-85416</guid>
		<description>Hm, I think that it is illegal to call flush inside JTA transaction on JPA EntityManager. Or maybe only inside XA transactions, but anyway, behavior is application server specific.</description>
		<content:encoded><![CDATA[<p>Hm, I think that it is illegal to call flush inside JTA transaction on JPA EntityManager. Or maybe only inside XA transactions, but anyway, behavior is application server specific.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: holly</title>
		<link>http://blog.springsource.com/2008/01/04/before-a-jdbc-operation-flush-the-hibernate-session-includes-tse-example-code/#comment-85135</link>
		<dc:creator>holly</dc:creator>
		<pubDate>Sat, 05 Jan 2008 21:01:21 +0000</pubDate>
		<guid isPermaLink="false">http://blog.interface21.com/main/2008/01/04/before-a-jdbc-operation-flush-the-hibernate-session-includes-tse-example-code/#comment-85135</guid>
		<description>Hi Alef,
I posted a question about this on the spring forum a week ago, particularly sparked by this topic you reviewed at TSE via code and discussion. I have been all through Juergen's code in the orm.ibatis package which my current client is implementing and which I've done a little bit of extending, but I am really wondering if anyone, you or Juergen, know if the flush needs to be done for ibatis as with hibernate. Any thoughts on best practices or necessary actions?

http://forum.springframework.org/showthread.php?p=158511#post158511

kind regards,holly</description>
		<content:encoded><![CDATA[<p>Hi Alef,<br />
I posted a question about this on the spring forum a week ago, particularly sparked by this topic you reviewed at TSE via code and discussion. I have been all through Juergen&#039;s code in the orm.ibatis package which my current client is implementing and which I&#039;ve done a little bit of extending, but I am really wondering if anyone, you or Juergen, know if the flush needs to be done for ibatis as with hibernate. Any thoughts on best practices or necessary actions?</p>
<p><a href="http://forum.springframework.org/showthread.php?p=158511#post158511" rel="nofollow">http://forum.springframework.org/showthread.php?p=158511#post158511</a></p>
<p>kind regards,holly</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amaury</title>
		<link>http://blog.springsource.com/2008/01/04/before-a-jdbc-operation-flush-the-hibernate-session-includes-tse-example-code/#comment-85090</link>
		<dc:creator>Amaury</dc:creator>
		<pubDate>Sat, 05 Jan 2008 17:43:56 +0000</pubDate>
		<guid isPermaLink="false">http://blog.interface21.com/main/2008/01/04/before-a-jdbc-operation-flush-the-hibernate-session-includes-tse-example-code/#comment-85090</guid>
		<description>Interesting article.

I just wanted to mention that flushing the session (that is the first level cache) might not be enough when performing direct jdbc updates : it won't flush your second level cache and there will a be some mismatch between the orm and the database at least until the cache expires. 

That's the reason why I just try to avoid direct updates and only limit jdbc calls to selects.

My 2 cents ;-)</description>
		<content:encoded><![CDATA[<p>Interesting article.</p>
<p>I just wanted to mention that flushing the session (that is the first level cache) might not be enough when performing direct jdbc updates : it won&#039;t flush your second level cache and there will a be some mismatch between the orm and the database at least until the cache expires. </p>
<p>That&#039;s the reason why I just try to avoid direct updates and only limit jdbc calls to selects.</p>
<p>My 2 cents <img src='http://blog.springsource.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: links for 2008-01-05</title>
		<link>http://blog.springsource.com/2008/01/04/before-a-jdbc-operation-flush-the-hibernate-session-includes-tse-example-code/#comment-84957</link>
		<dc:creator>links for 2008-01-05</dc:creator>
		<pubDate>Sat, 05 Jan 2008 08:27:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.interface21.com/main/2008/01/04/before-a-jdbc-operation-flush-the-hibernate-session-includes-tse-example-code/#comment-84957</guid>
		<description>[...] SpringSource Team Blog » Before a JDBC operation, flush the Hibernate Session (includes TSE example code) Mixing code in one and the same transaction that uses an Object-Relational Mapper with code that doesn&#8217;t, can cause issues with data not being available in the underlying database when it should be. Since this is a situation I come across once every now a (tags: aop AspectJ database Hibernate jdbc ORM spring sql toread) [...]</description>
		<content:encoded><![CDATA[<p>[...] SpringSource Team Blog » Before a JDBC operation, flush the Hibernate Session (includes TSE example code) Mixing code in one and the same transaction that uses an Object-Relational Mapper with code that doesn&#039;t, can cause issues with data not being available in the underlying database when it should be. Since this is a situation I come across once every now a (tags: aop AspectJ database Hibernate jdbc ORM spring sql toread) [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
