<?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>Blog::Log &#187; hibernate</title>
	<atom:link href="http://www.stpe.se/tag/hibernate/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stpe.se</link>
	<description>Not a blog, more a log.</description>
	<lastBuildDate>Wed, 02 Jun 2010 13:01:58 +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 Annotations examples and reference</title>
		<link>http://www.stpe.se/2008/07/hibernate-annotations-examples-and-reference/</link>
		<comments>http://www.stpe.se/2008/07/hibernate-annotations-examples-and-reference/#comments</comments>
		<pubDate>Tue, 22 Jul 2008 18:08:00 +0000</pubDate>
		<dc:creator>stefan</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[hibernate]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.stpe.se/?p=46</guid>
		<description><![CDATA[Found a really great reference with examples of Hibernate association mappings using annotations. http://tadtech.blogspot.com/2007/09/hibernate-association-mappings-in.html]]></description>
			<content:encoded><![CDATA[<p>Found a really great reference with examples of Hibernate association mappings using annotations.</p>
<p><a href="http://tadtech.blogspot.com/2007/09/hibernate-association-mappings-in.html">http://tadtech.blogspot.com/2007/09/hibernate-association-mappings-in.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.stpe.se/2008/07/hibernate-annotations-examples-and-reference/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hibernate HQL like query using named parameters</title>
		<link>http://www.stpe.se/2008/07/hibernate-hql-like-query-named-parameters/</link>
		<comments>http://www.stpe.se/2008/07/hibernate-hql-like-query-named-parameters/#comments</comments>
		<pubDate>Thu, 03 Jul 2008 09:03:42 +0000</pubDate>
		<dc:creator>stefan</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[hibernate]]></category>
		<category><![CDATA[hql]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.stpe.se/?p=23</guid>
		<description><![CDATA[Using the LIKE condition with a &#8220;%&#8221; sign for pattern matching in a HQL query with named parameters required some tweaking. This did not work: String query = &#34;from user u where u.name like %:name%&#34; getHibernateTemplate().findByNamedParam(query, &#34;name&#34;, str); It resulted in a org.hibernate.QueryException: unexpected char: &#8216;%&#8217; error. Next I tried using single quotes: String query [...]]]></description>
			<content:encoded><![CDATA[<p>Using the LIKE condition with a &#8220;%&#8221; sign for pattern matching in a HQL query with named parameters required some tweaking.</p>
<p>This did not work:</p>
<pre class="brush: java;">
String query = &quot;from user u where u.name like %:name%&quot;

getHibernateTemplate().findByNamedParam(query, &quot;name&quot;, str);
</pre>
<p>It resulted in a <em>org.hibernate.QueryException: unexpected char: &#8216;%&#8217;</em> error.</p>
<p>Next I tried using single quotes:</p>
<pre class="brush: java;">
String query = &quot;from user u where u.name like '%:name%'&quot;

getHibernateTemplate().findByNamedParam(query, &quot;name&quot;, str);
</pre>
<p>Didn&#8217;t work either, an <em>org.hibernate.QueryParameterException: could not locate named parameter</em>.</p>
<p>What actually worked was putting the &#8220;%&#8221; signs in the parameter:</p>
<pre class="brush: java;">
String query = &quot;from user u where u.name like :name&quot;

getHibernateTemplate().findByNamedParam(query, &quot;name&quot;, '%' + str + '%');
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.stpe.se/2008/07/hibernate-hql-like-query-named-parameters/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
	</channel>
</rss>
