<?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>MikeWitters.com &#187; Portal</title>
	<atom:link href="http://mikewitters.com/category/portal/feed/" rel="self" type="application/rss+xml" />
	<link>http://mikewitters.com</link>
	<description>My $0.02 on stuff.</description>
	<lastBuildDate>Thu, 29 Oct 2009 00:05:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Hibernating with WebSphere and a non-journaling DB2/400 system</title>
		<link>http://mikewitters.com/2007/hibernating-with-websphere-and-a-non-journaling-db2400-system/</link>
		<comments>http://mikewitters.com/2007/hibernating-with-websphere-and-a-non-journaling-db2400-system/#comments</comments>
		<pubDate>Wed, 05 Dec 2007 03:51:55 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[Portal]]></category>
		<category><![CDATA[SoftwareDev]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://mikewitters.com/?p=35</guid>
		<description><![CDATA[A few years ago, I worked as a consultant at a company that used DB2/400 as its main database platform.  The company did not have journaling &#8216;turned on&#8217; so their database platform did not support transactions/commit control.  This did seem odd to me, but what I&#8217;ve found is that its pretty common that DB2/400 shops don&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>A few years ago, I worked as a consultant at a company that used DB2/400 as its main database platform.  The company did not have journaling &#8216;turned on&#8217; so their database platform did not support transactions/commit control.  This did seem odd to me, but what I&#8217;ve found is that its <a href="http://www.ginko.de/user/michael.justin/as400/db2/cc/index.html">pretty common that DB2/400 shops don&#8217;t use this feature</a>. While this seemed like a mere oddity and an inconvenience for commit control, it actually caused a more measurable issue which was that we couldn&#8217;t use Hibernate, one of, if not the most common ORM framework. Hibernate <a href="http://forum.hibernate.org/viewtopic.php?t=924511&amp;highlight=sql7008">requires</a> transactions. This is a problem for anyone wanting to use a non-journaled DB2/400 instance&#8230; in particular me.<span id="more-35"></span></p>
<p>After a few hours of discovering this issue and looking into it, I found a simple work around, which was to set the hibernate property &#8216;hibernate.connection.isolation&#8217; to 0 using the following XML in the config file:</p>
<p><code>&lt;property name="hibernate.connection.isolation"&gt;0&lt;/property&gt;</code></p>
<p>The problem for me arose when I needed to write applications using a shared connection coming from a WebSphere DataSource. I couldn&#8217;t find a way to tell the WebSphere DataSource to use the transaction isolation level of &#8216;0&#8242; or &#8216;NONE&#8217;. There were a couple of things I found that seemed to indicate a way, but none of them worked. I had to suck it up and just write SQL for simple CRUD operations.</p>
<p>Since I took a job at that company, it has affected me in a more cumulative way. Most of the java apps we write are for WebSphere AS or WebSphere Portal, both of which can and should use WebSphere datasources. I knew that if I didn&#8217;t solve this problem, the team would spend a whole lot of time writing CRUD SQL and incur the expense of the time writing the SQL, the expense of fixing the errors introduced writing the SQL, and not be able to take advantage of the simplicity provided by using an ORM framework like Hibernate. So on my latest project I made it a priority to solve this problem. I first started with talking with some folks about getting journaling enabled on the DB2/400 files I was working with. After a few minutes of this conversation I decided it&#8217;d be better to make use of the &#8216;open&#8217; part of the &#8216;open source&#8217; code base of hibernate. After a few hours of internet research of this issue and looking at some of the Hibernate source I figured if I could just set the &#8216;autoCommit&#8217; property of the javax.sql.Connection to true and set the transactionIsolation level to &#8216;NONE&#8217; (or 0 if you&#8217;re into literal values) then I&#8217;d be set. I tested this by hacking into the actual connection object Hibernate was using right before my SQL statement executions. It worked so I was happy, but I didnt want us to have to do this &#8216;HACK&#8217; everytime we wanted to use Hibernate with a DB2/400 data source. So I started looking at other ways. I found one.</p>
<p>The default WebSphere DataSource Helper for the iSeries Toolbox is the class com.winwholesale.db2400.hibernate.DB2AS400DataStoreHelper. After looking around enough I found that there were a few methods on the &#8216;helper&#8217; that could allow me to solve our problem. First was the method that showed that the helper was actually the class that indicated the transaction isolation level, called (interesting enough) getIsolationLevel. I created a new DataSource Helper class that extends the normal AS400 one and returned: <code>javax.sql.Connection.TRANSACTION_NONE</code></p>
<p>This accomplished half of what I needed, but I still had to deal with setting the autoCommit property to true. The helper made it simple to set this. It has a method called <code>doConnectionSetup</code> that allows you to do whatever you want to the connection before it&#8217;s used. So I added my autoCommit assignment there. Here is the total code of our new helper class:</p>
<p><code><br />
import java.sql.Connection;<br />
import java.sql.SQLException;<br />
import java.util.Properties;<br />
import javax.resource.ResourceException;<br />
import com.ibm.websphere.appprofile.accessintent.AccessIntent;<br />
import com.ibm.websphere.rsadapter.DB2AS400DataStoreHelper;</p>
<p>public class DB2400HibernateDSHelper extends DB2AS400DataStoreHelper {<br />
    public DB2400HibernateDSHelper( Properties props){<br />
      super(props);<br />
    }<br />
    public void doConnectionSetup(Connection connection) throws SQLException {<br />
      super.doConnectionSetup(connection);<br />
      connection.setAutoCommit( true );<br />
    }<br />
    public int getIsolationLevel(AccessIntent arg0) throws ResourceException {<br />
       return Connection.TRANSACTION_NONE;<br />
    }<br />
}</code></p>
<p>As you can see, it is very simple.</p>
<p>Now, understand that this works for us based on the fact that the DataSource connections are not going to be able to used for transactions in our environment on any files. If you have an environment that uses journaling on some files but not others this would probably be a problem for you since we&#8217;re setting these properties on a connection level. So be sure to research the issue before you use this simple approach. If you find a better way, please let me know.</p>
<p>If this helps one person then it was worth it&#8230;. wait, it helped me. <img src='http://mikewitters.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  It was worth it.</p>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://mikewitters.com/2007/hibernating-with-websphere-and-a-non-journaling-db2400-system/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Entering the blogosphere &#8211; with purpose.</title>
		<link>http://mikewitters.com/2007/entering-the-blogosphere-with-purpose/</link>
		<comments>http://mikewitters.com/2007/entering-the-blogosphere-with-purpose/#comments</comments>
		<pubDate>Sat, 14 Apr 2007 23:50:47 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[EAI]]></category>
		<category><![CDATA[LifeLessons]]></category>
		<category><![CDATA[Portal]]></category>
		<category><![CDATA[ProfessionalStuff]]></category>
		<category><![CDATA[SoftwareDev]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://192.168.1.4/?p=16</guid>
		<description><![CDATA[So why do I blog?  Well, a few weeks ago I heard a guy in a podcast or something, can&#8217;t remember exactly, say something along the lines of &#8220;With the way information is flowing today, and what KIDS just know about the internet and online identities, if you&#8217;re in a tech field and you [...]]]></description>
			<content:encoded><![CDATA[<p>So why do I blog?  Well, a few weeks ago I heard a guy in a podcast or something, can&#8217;t remember exactly, say something along the lines of &#8220;With the way information is flowing today, and what KIDS just know about the internet and online identities, if you&#8217;re in a tech field and you don&#8217;t have an online identity in 2010 then you will be at a disadvantage to those who do.&#8221;   I can&#8217;t remember the details because at the moment I giggled about it.  A few days later, during my daughters 3rd birthday party at my house, I walked into my office and found my wife trying to help my nephew upload a picture she had just taken of him into his myspace page.  We fiddled around with it for a bit and finally got it done.  I was somewhat taken by the fact that he&#8217;s 12 years old and was talking about this friends page and that friends page, how cool they were, and how many people visited them.  I decided that the guy I had heard was probably right.  I wish I would have paid more attention to who he was.  I do remember that he had started and sold 4 or 5 companies that were on the edge of technology &#8211; basically the commentator was saying he had a knack for seeing things coming and being right about them. <span id="more-16"></span><br />
I decided to create an online persona&#8230; even if noone sees any of it.  I also decided I had to do it with a purpose.  I struggled with what sort of content to blog about:  gripes, programming, design and architecture stuff, or whatever.  Up to now I&#8217;ve pretty much just babbled on about this or that.  I will probably still do so from time to time, but I&#8217;m going to try to focus on important issues&#8230; things that I can offer some intelligible thoughts and ideas to.  I dont want to be the four hundred thousandth guy who teaches you how to make curved divs with CSS or the 2 millionth who says you should check into SOA.  I want to be more pointed.  So, there are 4 major categories of stuff I&#8217;m going to have on the site.  First, I have decided to make available some of the code I re-write in one form or another client after client.  I&#8217;ll write them with a generic spin so that they aren&#8217;t tailored to any client.  Second, I want to document the &#8216;gotchas&#8217; that I see in architecture and development.  Any one might be a small code level issue or some major enterprise architecture decision that could derail whatever it is you are working on.  Third, general development and architecture &#8216;preaching&#8217; &#8211; self explanatory.  And finally, anything else I want to mention.  I&#8217;ll try to keep this to a minimum and I&#8217;ll try to make sure that whatever it is has a point &#8211; Again, I don&#8217;t want to just babble.  <img src='http://mikewitters.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
The first framework I&#8217;m going to make available is what I&#8217;m calling <strong>JobMF</strong> (Java Organized Byte Message Framework).  It will be a framework for creating &#8216;fixed&#8217; format messages in Java.  See my next post for more details.  It&#8217;s a crappy name, and I&#8217;ll take suggestions for a new one if you&#8217;ve got any.  I have a list of &#8216;gotchas&#8217; a mile long so I just have to decide what is worthy and post them.  As for the other stuff, well, as the mood strikes me about something, I&#8217;ll write it up.<br />
Anyways, enough babbling about what I&#8217;m going to try to not just babble about in the future.  I hope I write something that people find interesting.</p>
]]></content:encoded>
			<wfw:commentRss>http://mikewitters.com/2007/entering-the-blogosphere-with-purpose/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Development Guidlines for recent project</title>
		<link>http://mikewitters.com/2007/portlet-development-guidlines-for-recent-project/</link>
		<comments>http://mikewitters.com/2007/portlet-development-guidlines-for-recent-project/#comments</comments>
		<pubDate>Fri, 06 Apr 2007 02:27:47 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Portal]]></category>
		<category><![CDATA[SoftwareDev]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://192.168.1.4/?p=11</guid>
		<description><![CDATA[At one of my clients we were seeing the occasional spike in memory usage of their portal server.  We’ve even seen some of the dreaded OutOfMemoryErrors.  Most of the memory growth was natural – due to the growing usage of the portal.  The errors are not natural – so something had to [...]]]></description>
			<content:encoded><![CDATA[<p>At one of my clients we were seeing the occasional spike in memory usage of their portal server.  We’ve even seen some of the dreaded OutOfMemoryErrors.  Most of the memory growth was natural – due to the growing usage of the portal.  The errors are not natural – so something had to be done.  At a minimum we needed to layout some guidelines for the developers to follow from hence forward to keep from compounding the problem.</p>
<p>This is a single server environment, no clustering.  Over the past couple of years, the technical leadership at the client wanted to focus on speed over memory usage.  In general, this meant that instead of re-executing the action phase when a page needed re-rendered, items that were needed for rendering were thrown onto the session.  This alone can be considered OK in some circumstances.  If the objects are small and few then it’s not that big a deal.  But in a portal, almost by definition, there are a lot of applications.  So if a lot of applications start throwing objects all over sessions then it can become a problem pretty quickly.</p>
<p>In addition to the times where the objects were small and few, there were times when it was done out of performance necessity.  In one instance, searching for items in a Domino ‘archive’ takes over a minute.  The fact that this might be fixable some other way aside; this is not something one would want to have happen every time you re-render the page that this portlet sits on.  So you store the items on the session.  The next question is how many do you store?  Do you store the entire result set?  Hopefully you limit it to some reasonable size, but reasonable to who?</p>
<p>These are a small subset of what we laid out.  Note: These are definitely not specific to portal applications.</p>
<ol>
<li>	Limit Session Storage
<ul>
<li>Minimize information stored on session</li>
<li>Use hidden variables in forms</li>
</ul>
</li>
<li>	Do not store large collections on the session
<ul>
<li>Limit to reasonable size with paging (# per page, alphabetic, date range, etc)</li>
</ul>
</li>
<li>	Limit database result set sizes to smallest usable size.
<ul>
<li>If your result sets have more items than the stated threshold, don’t retrieve all of them.</li>
<li>If your result sets have less items than the stated threshold, don’t retrieve all of  them unless you have to</li>
<li>If you can page through them do that.</li>
<li>Use reasonable judgment based on the ‘size’ of the objects in the result set.  </li>
</ul>
</li>
<li>If you are building large complex objects for each result, limit to a smaller number stored on session or use design patterns to solve the re-execute issue.</li>
<li>	Use String constants when possible
<ul>
<li>For any re-used string values</li>
<li>Database library, table, and column names that are used more than once</li>
</ul>
</li>
<li>	Use StringBuffers instead of String concatenation always
	</li>
<li>Use client side sorting when possible
<ul>
<li>Single level sorts</li>
<li>Relatively small result sets</li>
</ul>
</li>
<li>	Release any session memory by using session.removeAttribute when that data has been consumed and is no longer needed.
	</li>
<li>	 Always cleanup resources, such as database connections, in a finally block to guarantee that they are done.
	</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://mikewitters.com/2007/portlet-development-guidlines-for-recent-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
