<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Developer on Architecture and Data Blog</title>
    <link>https://sadalage.com/tags/developer/</link>
    <description>Recent content in Developer on Architecture and Data Blog</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Mon, 15 Jul 2019 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://sadalage.com/tags/developer/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>SSL Connection to AWS Aurora</title>
      <link>https://sadalage.com/post/ssl-aws-aurora/</link>
      <pubDate>Mon, 15 Jul 2019 00:00:00 +0000</pubDate>
      <guid>https://sadalage.com/post/ssl-aws-aurora/</guid>
      <description>&lt;p&gt;On a recent project we had to connect to AWS Aurora postgres 10.6 version of the database in SSL mode using JDBC and Java 11 JRE. When the Aurora cluster is setup, we can force all connections to use SSL by using the options group settings (&lt;code&gt;forceSSL=true&lt;/code&gt;), establishing secure connection from the application to the database is not as easy as it looks.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Static Analysis of PL/SQL code</title>
      <link>https://sadalage.com/post/static-analysis-of-plsql-code/</link>
      <pubDate>Tue, 01 Aug 2017 00:00:00 +0000</pubDate>
      <guid>https://sadalage.com/post/static-analysis-of-plsql-code/</guid>
      <description>&lt;p&gt;In all new development and sometimes during legacy codebase modernization, developers tend to add code quality checks and static analysis of codebase such as style checks, bug finders, cyclomatic complexity checking etc. into the CI/CD pipeline. When we inherit a codebase that has much PL/SQL and there is a desire to put the PL/SQL code base through the same types of code analysis, what options does a developer/dba have?&lt;/p&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>MSSQL JDBC Driver behavior&#34;</title>
      <link>https://sadalage.com/post/mssql_jdbc_driver_behavior/</link>
      <pubDate>Sun, 22 Apr 2012 00:00:00 +0000</pubDate>
      <guid>https://sadalage.com/post/mssql_jdbc_driver_behavior/</guid>
      <description>&lt;p&gt;My latest project involves talking to MS-SQL Server using the JDBC driver and Java. While doing this we setup the database connection and had a simple SQL to get the &lt;em&gt;first_name&lt;/em&gt; and &lt;em&gt;last_name&lt;/em&gt; for a unique &lt;em&gt;user_id&lt;/em&gt; from the &lt;em&gt;application_user&lt;/em&gt; table in the database.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT first_name,last_name&#xA;FROM application_user&#xA;WHERE user_id = ?&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Given the above SQL, we did not think too much about performance as the &lt;em&gt;user_id&lt;/em&gt; was indexed. The java code as below was used to run the SQL.&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>
    <item>
      <title>Frameworks should not constrain your table design</title>
      <link>https://sadalage.com/post/frameworks_should_not_constrain_design/</link>
      <pubDate>Wed, 03 Oct 2007 00:00:00 +0000</pubDate>
      <guid>https://sadalage.com/post/frameworks_should_not_constrain_design/</guid>
      <description>&lt;p&gt;Recently talking to someone about a persistence framework that they are using,&#xA;this framework creates a rows in the database table with just Primary Key value&#xA;and then later on updates the table row with values for other columns. Because&#xA;of this framework, the tables cannot have any NOT-NULL constraints defined.&lt;/p&gt;&#xA;&lt;p&gt;For example, the framework is doing&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-SQL&#34; data-lang=&#34;SQL&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#6ab825;font-weight:bold&#34;&gt;INSERT&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;INTO&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt; &lt;/span&gt;customer&lt;span style=&#34;color:#666&#34;&gt; &lt;/span&gt;(customerId,&lt;span style=&#34;color:#666&#34;&gt; &lt;/span&gt;name,&lt;span style=&#34;color:#666&#34;&gt; &lt;/span&gt;birthdate)&lt;span style=&#34;color:#666&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#6ab825;font-weight:bold&#34;&gt;VALUES&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt; &lt;/span&gt;(&lt;span style=&#34;color:#3677a9&#34;&gt;1&lt;/span&gt;,&lt;span style=&#34;color:#6ab825;font-weight:bold&#34;&gt;null&lt;/span&gt;,&lt;span style=&#34;color:#6ab825;font-weight:bold&#34;&gt;null&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;UPDATE&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt; &lt;/span&gt;customer&lt;span style=&#34;color:#666&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#6ab825;font-weight:bold&#34;&gt;set&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt; &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;#39;FOO Name&amp;#39;&lt;/span&gt;,&lt;span style=&#34;color:#666&#34;&gt; &lt;/span&gt;birthdate&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;#39;12/12/1978&amp;#39;&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;WHERE&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt; &lt;/span&gt;customerId&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:#3677a9&#34;&gt;1&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;You cannot have NON-NULL constraint defined on name or birthdate column, since&#xA;the INSERT statement would blow up, forcing you to change table design&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
