<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Hsqldb on Nick Spacek</title><link>https://spacek.ca/tags/hsqldb/</link><description>Recent content in Hsqldb on Nick Spacek</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Wed, 18 Sep 2013 00:00:00 +0000</lastBuildDate><atom:link href="https://spacek.ca/tags/hsqldb/index.xml" rel="self" type="application/rss+xml"/><item><title>HSQLDB with Hibernate: addScalar</title><link>https://spacek.ca/2013/09/18/hsqldb-with-hibernate-addscalar/</link><pubDate>Wed, 18 Sep 2013 00:00:00 +0000</pubDate><guid>https://spacek.ca/2013/09/18/hsqldb-with-hibernate-addscalar/</guid><description>&lt;p&gt;{% include JB/setup %}&lt;/p&gt;
&lt;p&gt;To continue this series, I just have another little cautionary bit of advice
regarding using &lt;code&gt;addScalar&lt;/code&gt; with your &lt;code&gt;createSQLQuery(...)&lt;/code&gt; operations. In
MySQL, a query like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-sql" data-lang="sql"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;SELECT&lt;/span&gt; obj.name, other.name, third.name
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;FROM&lt;/span&gt; obj, other, third&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Will give the full name of those columns in the &amp;ldquo;result set metadata&amp;rdquo; that
Hibernate accesses. So when you use &lt;code&gt;addScalar&lt;/code&gt;, you can just say:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-java" data-lang="java"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;.&lt;span style="color:#a6e22e"&gt;addScalar&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;obj.name&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;.&lt;span style="color:#a6e22e"&gt;addScalar&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;other.name&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;.&lt;span style="color:#a6e22e"&gt;addScalar&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;third.name&amp;#34;&lt;/span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;However, in other database engines the columns might come back in the metadata
as &lt;code&gt;[ name, name, name ]&lt;/code&gt;; when you try to use &lt;code&gt;addScalar&lt;/code&gt; with the full path,
you will get an error. (I don&amp;rsquo;t believe that just calling &lt;code&gt;addScalar&lt;/code&gt; once with
&amp;ldquo;name&amp;rdquo; will apply to each of the three occurrences either, but I haven&amp;rsquo;t
checked).&lt;/p&gt;</description></item><item><title>HSQLDB with Hibernate: User lacks privilege or object not found</title><link>https://spacek.ca/2013/09/18/hsqldb-with-hibernate/</link><pubDate>Wed, 18 Sep 2013 00:00:00 +0000</pubDate><guid>https://spacek.ca/2013/09/18/hsqldb-with-hibernate/</guid><description>&lt;p&gt;{% include JB/setup %}&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m currently working to add unit tests to a project which currently has no
tests for its database query layer. Normally I wouldn&amp;rsquo;t worry too much, but
there are some nasty queries that have cropped up over the years that could
benefit from some testing.&lt;/p&gt;
&lt;p&gt;This project uses Hibernate and the custom queries are written mainly in some
MySQL-specific language. Part of the problem with adding tests has been that
the hbm2ddl tool hasn&amp;rsquo;t been able to reliably generate the database schema due
to some strange approaches to ID generation and other MySQL-specific code.&lt;/p&gt;</description></item></channel></rss>