<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Making Life Simple &#187; hibernate</title>
	<atom:link href="http://www.lalitmehta.com/home/tag/hibernate/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lalitmehta.com/home</link>
	<description></description>
	<lastBuildDate>Tue, 09 Feb 2010 21:36:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Hibernate get distinct list with Criteria</title>
		<link>http://www.lalitmehta.com/home/2008/04/03/hibernate-get-distinct-list-with-criteria/</link>
		<comments>http://www.lalitmehta.com/home/2008/04/03/hibernate-get-distinct-list-with-criteria/#comments</comments>
		<pubDate>Thu, 03 Apr 2008 21:38:41 +0000</pubDate>
		<dc:creator>lalit</dc:creator>
				<category><![CDATA[hibernate]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.lalitmehta.com/home/2008/04/03/hibernate-get-distinct-list-with-criteria/</guid>
		<description><![CDATA[The only way I could figure out to get the distinct list using Hibernate Criteria is by using ResultTransformer function. eg. List result = session.createCriteria(Order.class) &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY) &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;------- &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;.list(); The con is it fetches all the objects and then filters it. (very time consuming) The only way to circumvent this problem is to write query using [...]]]></description>
			<content:encoded><![CDATA[<p>The only way I could figure out to get the distinct list using Hibernate Criteria is by using ResultTransformer function.</p>
<p>eg.</p>
<p><code>List result = session.createCriteria(Order.class)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-------<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.list();<br />
</code></p>
<p>The con is it fetches all the objects and then filters it. (very time consuming)</p>
<p>The only way to circumvent this problem is to write query using HQL.</p>
<p>If you find a way to do that efficiently using Criteria, let me know <img src='http://www.lalitmehta.com/home/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.lalitmehta.com/home/2008/04/03/hibernate-get-distinct-list-with-criteria/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hibernate gives &#8220;No CurrentSessionContext configured&#8221; error</title>
		<link>http://www.lalitmehta.com/home/2006/03/12/hibernate-gives-no-currentsessioncontext-configured-error/</link>
		<comments>http://www.lalitmehta.com/home/2006/03/12/hibernate-gives-no-currentsessioncontext-configured-error/#comments</comments>
		<pubDate>Mon, 13 Mar 2006 02:43:55 +0000</pubDate>
		<dc:creator>lalit</dc:creator>
				<category><![CDATA[hibernate]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.lalitmehta.com/home/?p=7</guid>
		<description><![CDATA[If you use Hibernate in a managed environment (with JBoss or some other AS that Hibernate supoorts). Add this line to session-factory section: &#60;property name=&#8221;hibernate.current_session_context_class&#8221; &#62;jta &#60;/property&#62; If you use Hibernate in a non-managed environment (standalone application with JDBC). Add this line: &#60;property name=&#8221;hibernate.current_session_context_class&#8221; &#62;thread &#60;/property&#62;]]></description>
			<content:encoded><![CDATA[<p>If you use Hibernate in a managed environment (with JBoss or some other AS that Hibernate supoorts). Add this line to session-factory section:</p>
<p>&lt;property name=&#8221;hibernate.current_session_context_class&#8221; &gt;jta &lt;/property&gt;</p>
<p>If you use Hibernate in a non-managed environment (standalone application with JDBC). Add this line:</p>
<p>&lt;property name=&#8221;hibernate.current_session_context_class&#8221; &gt;thread &lt;/property&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lalitmehta.com/home/2006/03/12/hibernate-gives-no-currentsessioncontext-configured-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
