<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>FrameWork on Architecture and Data Blog</title>
    <link>https://sadalage.com/tags/framework/</link>
    <description>Recent content in FrameWork on Architecture and Data Blog</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Mon, 12 Jun 2017 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://sadalage.com/tags/framework/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>ID generation with ORM&#39;s Table, Sequence or Identity strategy</title>
      <link>https://sadalage.com/post/id-generation/</link>
      <pubDate>Mon, 12 Jun 2017 00:00:00 +0000</pubDate>
      <guid>https://sadalage.com/post/id-generation/</guid>
      <description>&lt;p&gt;In this blog post, I will discuss ID generation techniques using the Object Relation Mapping frameworks such as Hibernate, Toplink, ActiveRecord, Entity Framework. When using hibernate or any other ORM mapping framework. There is a need to generate primary key values for the &amp;ldquo;id&amp;rdquo; columns. These values can be generated by using IDENTITY, SEQUENCE or TABLE strategies.&#xA;Generating custom values for primary keys or other values is a topic for another blog post.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Using liquibase to load data and ignore some columns</title>
      <link>https://sadalage.com/post/using-liquibase-to-load-data-and-ignore-some-columns/</link>
      <pubDate>Mon, 15 May 2017 00:00:00 +0000</pubDate>
      <guid>https://sadalage.com/post/using-liquibase-to-load-data-and-ignore-some-columns/</guid>
      <description>&lt;p&gt;Loading data into tables is needed many times on projects to load test, &lt;a href=&#34;http://www.liquibase.org/&#34;&gt;Liquibase&lt;/a&gt; provides a method to load data into tables with lots of customization.&#xA;In the example shown below, I&amp;rsquo;m loading &lt;a href=&#34;http://federalgovernmentzipcodes.us/&#34;&gt;zip code data&lt;/a&gt; with the following column layout&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;#34;Zipcode&amp;#34;,&amp;#34;ZipCodeType&amp;#34;,&amp;#34;City&amp;#34;,&amp;#34;State&amp;#34;,&amp;#34;LocationType&amp;#34;,&amp;#34;Lat&amp;#34;,&amp;#34;Long&amp;#34;,&amp;#34;Location&amp;#34;,&amp;#34;Decommisioned&amp;#34;,&amp;#34;TaxReturnsFiled&amp;#34;,&amp;#34;EstimatedPopulation&amp;#34;,&amp;#34;TotalWages&amp;#34;&#xA;&lt;/code&gt;&lt;/pre&gt;</description>
    </item>
    <item>
      <title>Transactions using Groovy.SQL with Spring annotations and connection pools</title>
      <link>https://sadalage.com/post/transactions_using_groovysql/</link>
      <pubDate>Mon, 14 Jan 2013 00:00:00 +0000</pubDate>
      <guid>https://sadalage.com/post/transactions_using_groovysql/</guid>
      <description>&lt;p&gt;When using Groovy with Spring framework,  interacting with the database can be done using the Groovy.SQL class which provides a easy to use interface. When using Groovy.SQL, if we have a need to do transactions, we have the &lt;strong&gt;.withTransaction&lt;/strong&gt; method that accepts a closure, to which we can pass in code to execute within the transaction.&#xA;In our project since we were using spring already, using annotations to define transactions would be a great. Standard &lt;strong&gt;@Transactional&lt;/strong&gt; annotations with Groovy.SQL will not work, since every place where the Groovy.SQL is used a new connection is acquired from the connection pool causing the database work to span multiple connections, which can result in dead-locks on the database. What we really want is that the database connection be the same across all invocations of Groovy.SQL with-in the same transaction started by the annotated method.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Hibernate weirdness with property names</title>
      <link>https://sadalage.com/post/hibernate_weirdness_with_properties/</link>
      <pubDate>Fri, 24 Oct 2008 00:00:00 +0000</pubDate>
      <guid>https://sadalage.com/post/hibernate_weirdness_with_properties/</guid>
      <description>&lt;p&gt;Consider this Hibernate mapping&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#d0d0d0;background-color:#202020;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ffa500&#34;&gt;@Column&lt;/span&gt;(name&lt;span style=&#34;color:#666&#34;&gt; &lt;/span&gt;=&lt;span style=&#34;color:#666&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#ed9d13&#34;&gt;&amp;#34;qReferenceId&amp;#34;&lt;/span&gt;)&lt;span style=&#34;color:#666&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#666&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#6ab825;font-weight:bold&#34;&gt;public&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt; &lt;/span&gt;Long&lt;span style=&#34;color:#666&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#447fcf&#34;&gt;getQReferenceId&lt;/span&gt;()&lt;span style=&#34;color:#666&#34;&gt; &lt;/span&gt;{&lt;span style=&#34;color:#666&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#666&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#6ab825;font-weight:bold&#34;&gt;return&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt; &lt;/span&gt;qReferenceId;&lt;span style=&#34;color:#666&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#666&#34;&gt;&lt;/span&gt;}&lt;span style=&#34;color:#666&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Where &lt;em&gt;qReferenceId&lt;/em&gt; is data provided to our application via a external reference, we do not have a QReference Object or Table for FK references. When trying to query this object using DetachedQuery, this Simple expression was used.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#d0d0d0;background-color:#202020;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#6ab825;font-weight:bold&#34;&gt;public&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt; &lt;/span&gt;List&amp;lt;Movie&amp;gt;&lt;span style=&#34;color:#666&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#447fcf&#34;&gt;findByQReferenceId&lt;/span&gt;(Long&lt;span style=&#34;color:#666&#34;&gt; &lt;/span&gt;id)&lt;span style=&#34;color:#666&#34;&gt; &lt;/span&gt;{&lt;span style=&#34;color:#666&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#666&#34;&gt;     &lt;/span&gt;&lt;span style=&#34;color:#6ab825;font-weight:bold&#34;&gt;final&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt; &lt;/span&gt;SimpleExpression&lt;span style=&#34;color:#666&#34;&gt; &lt;/span&gt;matchesId&lt;span style=&#34;color:#666&#34;&gt; &lt;/span&gt;=&lt;span style=&#34;color:#666&#34;&gt; &lt;/span&gt;Property.&lt;span style=&#34;color:#bbb&#34;&gt;forName&lt;/span&gt;(&lt;span style=&#34;color:#ed9d13&#34;&gt;&amp;#34;qReferenceId&amp;#34;&lt;/span&gt;).&lt;span style=&#34;color:#bbb&#34;&gt;eq&lt;/span&gt;(id);&lt;span style=&#34;color:#666&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#666&#34;&gt;    &lt;/span&gt;DetachedCriteria&lt;span style=&#34;color:#666&#34;&gt; &lt;/span&gt;criteria&lt;span style=&#34;color:#666&#34;&gt; &lt;/span&gt;=&lt;span style=&#34;color:#666&#34;&gt; &lt;/span&gt;DetachedCriteria.&lt;span style=&#34;color:#bbb&#34;&gt;forClass&lt;/span&gt;(Movie.&lt;span style=&#34;color:#bbb&#34;&gt;class&lt;/span&gt;);&lt;span style=&#34;color:#666&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#666&#34;&gt;    &lt;/span&gt;criteria&lt;span style=&#34;color:#666&#34;&gt; &lt;/span&gt;=&lt;span style=&#34;color:#666&#34;&gt; &lt;/span&gt;criteria.&lt;span style=&#34;color:#bbb&#34;&gt;add&lt;/span&gt;(matchesId);&lt;span style=&#34;color:#666&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#666&#34;&gt;    &lt;/span&gt;List&amp;lt;Movie&amp;gt;&lt;span style=&#34;color:#666&#34;&gt; &lt;/span&gt;movies&lt;span style=&#34;color:#666&#34;&gt; &lt;/span&gt;=&lt;span style=&#34;color:#666&#34;&gt; &lt;/span&gt;(List&amp;lt;Movie&amp;gt;)&lt;span style=&#34;color:#666&#34;&gt; &lt;/span&gt;getHibernateTemplate().&lt;span style=&#34;color:#bbb&#34;&gt;findByCriteria&lt;/span&gt;(criteria);&lt;span style=&#34;color:#666&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#666&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#6ab825;font-weight:bold&#34;&gt;return&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt; &lt;/span&gt;movies;&lt;span style=&#34;color:#666&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#666&#34;&gt;&lt;/span&gt;}&lt;span style=&#34;color:#666&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When running this method, I kept getting errors shown below.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
