<?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: Execute SQL outside of a transaction in Hibernate</title>
	<atom:link href="http://biotext.org.uk/execute-sql-outside-of-a-transaction-in-hibernate/feed/" rel="self" type="application/rss+xml" />
	<link>http://biotext.org.uk/execute-sql-outside-of-a-transaction-in-hibernate/</link>
	<description>Not a typewriter</description>
	<lastBuildDate>Sat, 07 Jan 2012 11:30:25 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Anatoli</title>
		<link>http://biotext.org.uk/execute-sql-outside-of-a-transaction-in-hibernate/comment-page-1/#comment-171</link>
		<dc:creator>Anatoli</dc:creator>
		<pubDate>Tue, 20 Apr 2010 05:19:34 +0000</pubDate>
		<guid isPermaLink="false">http://biotext.org.uk/?p=262#comment-171</guid>
		<description>good hack, thanks.

Slightly less dodgy solution would be do something like this:

            Connection connection = session.connection();
            connection.setAutoCommit(true);

            SingleConnectionDataSource singleConnectionDataSource = new SingleConnectionDataSource(connection, true);
            final JdbcTemplate template = new JdbcTemplate(singleConnectionDataSource);
            template.execute(sql);
            connection.setAutoCommit(false);



This way you are only using autocommit for one statement.</description>
		<content:encoded><![CDATA[<p>good hack, thanks.</p>
<p>Slightly less dodgy solution would be do something like this:</p>
<p>            Connection connection = session.connection();<br />
            connection.setAutoCommit(true);</p>
<p>            SingleConnectionDataSource singleConnectionDataSource = new SingleConnectionDataSource(connection, true);<br />
            final JdbcTemplate template = new JdbcTemplate(singleConnectionDataSource);<br />
            template.execute(sql);<br />
            connection.setAutoCommit(false);</p>
<p>This way you are only using autocommit for one statement.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan</title>
		<link>http://biotext.org.uk/execute-sql-outside-of-a-transaction-in-hibernate/comment-page-1/#comment-136</link>
		<dc:creator>Stefan</dc:creator>
		<pubDate>Fri, 07 Aug 2009 10:33:40 +0000</pubDate>
		<guid isPermaLink="false">http://biotext.org.uk/?p=262#comment-136</guid>
		<description>Thank&#039;s! Short but very useful article!</description>
		<content:encoded><![CDATA[<p>Thank&#8217;s! Short but very useful article!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

