<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>“That’s not a bug, it’s a feature.”</title>
	<atom:link href="http://ibnaziz.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://ibnaziz.wordpress.com</link>
	<description>... the awakening of a web developer.</description>
	<lastBuildDate>Mon, 28 Dec 2009 02:37:12 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='ibnaziz.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/f27daa2cb423e2fae253ab9277371885?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>“That’s not a bug, it’s a feature.”</title>
		<link>http://ibnaziz.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://ibnaziz.wordpress.com/osd.xml" title="“That’s not a bug, it’s a feature.”" />
		<item>
		<title>(Android) R.layout.main cannot be resolved !!</title>
		<link>http://ibnaziz.wordpress.com/2009/12/28/android-r-layout-main-not-recognised/</link>
		<comments>http://ibnaziz.wordpress.com/2009/12/28/android-r-layout-main-not-recognised/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 02:24:42 +0000</pubDate>
		<dc:creator>ibnaziz</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[mobile programming]]></category>
		<category><![CDATA[phone]]></category>
		<category><![CDATA[R.java]]></category>
		<category><![CDATA[R.layout.main]]></category>
		<category><![CDATA[R.layout.main cannot be resolved]]></category>
		<category><![CDATA[R.layout.main is not recognised]]></category>

		<guid isPermaLink="false">http://ibnaziz.wordpress.com/2009/12/28/android-r-layout-main-not-recognised/</guid>
		<description><![CDATA[Beginning android programming... everything seemed to be working... but the R.layout.main is not being recognised anymore !!<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ibnaziz.wordpress.com&blog=3722011&post=121&subd=ibnaziz&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong><span style="color:#ff0000;">Problem:</span></strong></p>
<p>Beginning android programming&#8230; everything seemed to be working&#8230; but the R.layout.main is not being recognised anymore !!</p>
<p><strong><span style="color:#ff0000;">Solution:</span></strong></p>
<p>Simply remove the &#8216;import android.R&#8217; statement&#8230; and things should be back to normal.</p>
<p><span style="color:#ff0000;"><strong>Context:</strong></span></p>
<p>Having the import android.R seems to refer to the default R.java provided by the android platform instead of the version for your application&#8230;. hence the main.xml being referred to is not found. Removing the import statement fixes the problem by causing the application to search for R.java locally.</p>
<p>&#8230;wa&#8217;Allahu A&#8217;lam !</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ibnaziz.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ibnaziz.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ibnaziz.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ibnaziz.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ibnaziz.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ibnaziz.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ibnaziz.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ibnaziz.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ibnaziz.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ibnaziz.wordpress.com/121/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ibnaziz.wordpress.com&blog=3722011&post=121&subd=ibnaziz&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ibnaziz.wordpress.com/2009/12/28/android-r-layout-main-not-recognised/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f6e3bf313857892715911f2420425f0d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ibnaziz</media:title>
		</media:content>
	</item>
		<item>
		<title>Cached up in Google !</title>
		<link>http://ibnaziz.wordpress.com/2009/09/02/cached-up-in-google/</link>
		<comments>http://ibnaziz.wordpress.com/2009/09/02/cached-up-in-google/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 02:19:55 +0000</pubDate>
		<dc:creator>ibnaziz</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[JSP]]></category>
		<category><![CDATA[XHTML]]></category>
		<category><![CDATA[crawl bots]]></category>
		<category><![CDATA[robots meta tag]]></category>
		<category><![CDATA[search indexing]]></category>

		<guid isPermaLink="false">http://ibnaziz.wordpress.com/?p=117</guid>
		<description><![CDATA[A client accidentally found, to his surprise, that google had somehow managed to cache a "secure" page from his private web application !! Well, alhumdulillah... there now seems to be a way to prevent this from happening again...<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ibnaziz.wordpress.com&blog=3722011&post=117&subd=ibnaziz&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><span style="color:#ff0000;"><strong>Problem:</strong></span></p>
<p>A client accidentally found, to his surprise, that google had somehow managed to cache a &#8220;secure&#8221; page from his private web application !!<br />
<strong><span style="color:#ff0000;"> </span></strong></p>
<p><strong><span style="color:#ff0000;">Solution:</span><br />
</strong><br />
To prevent something like this from happening again, the following meta tags must be included in the relevant html/jsp pages&#8230; to instruct search robots NOT to include the tagged pages into their search listings :-</p>
<pre>&lt;meta name="robots" content="none"&gt;
&lt;meta name="robots" content="noarchive"&gt;</pre>
<p><span style="color:#ff0000;"><strong>Reference:</strong></span></p>
<p><a href="http://googlewebmastercentral.blogspot.com/2007/03/using-robots-meta-tag.html">Google &#8211; Using the robots meta tag</a></p>
<p>&#8230; wAllahu A&#8217;lam !</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ibnaziz.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ibnaziz.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ibnaziz.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ibnaziz.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ibnaziz.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ibnaziz.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ibnaziz.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ibnaziz.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ibnaziz.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ibnaziz.wordpress.com/117/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ibnaziz.wordpress.com&blog=3722011&post=117&subd=ibnaziz&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ibnaziz.wordpress.com/2009/09/02/cached-up-in-google/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f6e3bf313857892715911f2420425f0d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ibnaziz</media:title>
		</media:content>
	</item>
		<item>
		<title>POJO Annotation (hibernate) Example</title>
		<link>http://ibnaziz.wordpress.com/2009/08/26/pojo-annotation-hibernate-example/</link>
		<comments>http://ibnaziz.wordpress.com/2009/08/26/pojo-annotation-hibernate-example/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 05:10:45 +0000</pubDate>
		<dc:creator>ibnaziz</dc:creator>
				<category><![CDATA[Annotations]]></category>
		<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Netbeans]]></category>
		<category><![CDATA[Annotation]]></category>
		<category><![CDATA[Hibernate Annotations]]></category>
		<category><![CDATA[POJO Annotation]]></category>

		<guid isPermaLink="false">http://ibnaziz.wordpress.com/?p=109</guid>
		<description><![CDATA[Simple example of what a java pojo that has been hibernate annotated may look like, along with it's corresponding sql file.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ibnaziz.wordpress.com&blog=3722011&post=109&subd=ibnaziz&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><span style="color:#333333;">The following is an example of what a hibernate annotated java file may look like&#8230;</span></p>
<p><strong><span style="color:#ff0000;">Source :</span></strong></p>
<pre>/*
 * filename: Tax.java
 * descrip.: represents the tax object ( tax domain )
 */

package com.foo.tax.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * Represents the Tax entity.
 *
 * please note if the table name is the same as the class name
 * then the @table annotation doesn't need to be specified
 */
@Entity
@SequenceGenerator( name="fooTaxIdSeq", sequenceName="FOO_TAX_ID_SEQ", allocationSize=1)
@Table(name="FOO_TAX")
public class Tax
{
    private Long id = null;
    private String name = null;
    private double percentage = 0;

    @Id @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="fooTaxIdSeq")
    @Column(name="ID", nullable=false, unique=true)
    public Long getId()
    {
	return id;
    }

    // no need for the name as we want the defualt to be used
    @Column( nullable=false, unique=true )
    public String getName()
    {
	return name;
    }

    public void setName(String name)
    {
	this.name = name;
    }

    // equivalent to NUMBERIC( 256, 2 )
    @Column( nullable=false, precision=256, scale=2 )
    public double getPercentage()
    {
	return percentage;
    }

    public void setPercentage(double type)
    {
	this.percentage = type;
    }
}</pre>
<p><strong><span style="color:#ff0000;">Notes :</span></strong></p>
<p><span style="color:#333333;">- assuming that database id generation is in place, as opposed to application generated.</span></p>
<p><span style="color:#333333;">- the &#8216;@SequenceGenerator&#8217; has been declared at the class level, and it is used at the method level with, &#8216;@Id @GeneratedValue&#8217;. Please note the &#8216;<strong>generator=&#8221;fooTaxIdSeq&#8221;</strong>&#8216;.</span></p>
<p><span style="color:#333333;">- also please note that the &#8216;@SequenceGenerator&#8217; specification is somewhat database dependant, and that in this case the above combination works for PostGres. A different database may require a different specification.</span></p>
<p><span style="color:#333333;">And the following is a corresponding table creation sql file for the above pojo&#8230;</span></p>
<p><span style="color:#ff0000;"><strong>Source:</strong></span></p>
<pre>-- filename: 1_tax_init.sql
-- description:
--   creates a 'foo_tax' table, along with a 'foo_tax_id_seq' sequence
--   that will be used to increment the id with every new tax entity

CREATE TABLE FOO_TAX (
	ID VARCHAR(36) PRIMARY KEY,
	VERSION INTEGER NOT NULL,
	ADDED_BY VARCHAR(36) NOT NULL,
	DATE_CREATED TIMESTAMP NOT NULL DEFAULT NOW(),
	MODIFIED_BY VARCHAR(36),
	DATE_MODIFIED TIMESTAMP,
	REMARKS TEXT,

	NAME VARCHAR(256) NOT NULL,
	PERCENTAGE NUMERIC(256,2) NOT NULL
);
ALTER TABLE FOO_TAX OWNER TO FOO_OWNER;

CREATE SEQUENCE FOO_TAX_ID_SEQ;
ALTER TABLE FOO_TAX_ID_SEQ OWNER TO FOO_OWNER;</pre>
<p><strong><span style="color:#ff0000;">Notes :</span></strong></p>
<p><span style="color:#333333;"><strong>- </strong>the &#8216;create sequence foo_tax_id_seq;&#8217; statement could have been omitted if the keyword &#8217;serial&#8217; was specified for the id column above.</span></p>
<pre>CREATE TABLE FOO_TAX (
	ID <strong>SERIAL</strong> VARCHAR(36) PRIMARY KEY,
        ...</pre>
<p><span style="color:#333333;">- this instructs the database that the id will be database generated, and the default name for the sequence table would have been the table name plus &#8216;id_seq&#8217;, so in this case &#8216;foo_tax_id_seq&#8217;.</span></p>
<p><span style="color:#333333;">&#8230; wa Allahu A&#8217;lam !</span></p>
<p><span style="color:#ff0000;"><span style="color:#000000;"> </span></span></p>
<div id="_mcePaste" style="overflow:hidden;position:absolute;left:-10000px;top:0;width:1px;height:1px;">/*<br />
* filename: Tax.java<br />
* descrip.: represents the tax object ( tax domain )<br />
*<br />
* Copyright 2009 X-IT Management Ltd.<br />
*/</p>
<p>package com.astra.tax.model;</p>
<p>import com.astra.common.model.BaseEntity;<br />
import javax.persistence.Column;<br />
import javax.persistence.Entity;<br />
import javax.persistence.GeneratedValue;<br />
import javax.persistence.GenerationType;<br />
import javax.persistence.Id;<br />
import javax.persistence.SequenceGenerator;<br />
import javax.persistence.Table;</p>
<p>/**<br />
* Represents the Tax entity.<br />
*/<br />
/* please note if the table name is the same as the class name<br />
* then the @table annotation doesn&#8217;t need to be specified<br />
*/<br />
@Entity<br />
@SequenceGenerator( name=&#8221;astraTaxIdSeq&#8221;, sequenceName=&#8221;ASTRA_TAX_ID_SEQ&#8221;, allocationSize=1)<br />
@Table(name=&#8221;ASTRA_TAX&#8221;)<br />
public class Tax extends BaseEntity<br />
{<br />
private String name = null;<br />
private double percentage = 0;</p>
<p>@Override<br />
@Id @GeneratedValue(strategy=GenerationType.SEQUENCE, generator=&#8221;astraTaxIdSeq&#8221;)<br />
@Column(name=&#8221;ID&#8221;, nullable=false, unique=true)<br />
public Long getId()<br />
{<br />
return id;<br />
}</p>
<p>// no need for the name as we want the defualt to be used<br />
@Column( nullable=false, unique=true )<br />
public String getName()<br />
{<br />
return name;<br />
}</p>
<p>public void setName(String name)<br />
{<br />
this.name = name;<br />
}</p>
<p>// equivalent to NUMBERIC( 256, 2 )<br />
@Column( nullable=false, precision=256, scale=2 )<br />
public double getPercentage()<br />
{<br />
return percentage;<br />
}</p>
<p>public void setPercentage(double type)<br />
{<br />
this.percentage = type;<br />
}<br />
}</p></div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ibnaziz.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ibnaziz.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ibnaziz.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ibnaziz.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ibnaziz.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ibnaziz.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ibnaziz.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ibnaziz.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ibnaziz.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ibnaziz.wordpress.com/109/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ibnaziz.wordpress.com&blog=3722011&post=109&subd=ibnaziz&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ibnaziz.wordpress.com/2009/08/26/pojo-annotation-hibernate-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f6e3bf313857892715911f2420425f0d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ibnaziz</media:title>
		</media:content>
	</item>
		<item>
		<title>Java Comparator Example</title>
		<link>http://ibnaziz.wordpress.com/2009/06/30/java-comparator-example/</link>
		<comments>http://ibnaziz.wordpress.com/2009/06/30/java-comparator-example/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 09:30:05 +0000</pubDate>
		<dc:creator>ibnaziz</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Netbeans]]></category>
		<category><![CDATA[Collections.sort]]></category>
		<category><![CDATA[Comparator]]></category>
		<category><![CDATA[java collections]]></category>
		<category><![CDATA[Java Comparable]]></category>
		<category><![CDATA[Java Comparator]]></category>
		<category><![CDATA[java list]]></category>

		<guid isPermaLink="false">http://ibnaziz.wordpress.com/?p=102</guid>
		<description><![CDATA[Java provides in built support for sorting a list of primitive types... with something like Collections.sort(list). Unfortunately things are not as simple for sorting a list of non-primitive types, since the java collections class doesn't know exactly how to sort this type of list... let's take Customer for an example....<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ibnaziz.wordpress.com&blog=3722011&post=102&subd=ibnaziz&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><span style="color:#ff0000;"><strong>Problem :</strong></span></p>
<p>Java provides in built support for sorting a list of primitive types&#8230; with something like <strong>Collections.sort(list)</strong>. Unfortunately things are not as simple for sorting a list of non-primitive types, since the java collections class doesn&#8217;t know exactly how to sort this type of list&#8230; let&#8217;s take Customer for an example&#8230;.</p>
<p><span style="color:#ff0000;"><strong>Solution 1 :</strong></span></p>
<p>1) Create a <strong>Comparator</strong> class for the desired entity.</p>
<p>2) Use this to show the Collections class, how the list is supposed to be sorted.</p>
<p><span style="text-decoration:underline;">i.e. CustomerByNameComparator.java</span></p>
<pre>...
public class CustomerByNameComparator implements Comparator&lt;Customer&gt;
{
     // compare(o1, o2) &lt; 0     - o1 is less than o2
     // compare(o1, o2) == 0    - o1 is equal to o2
     // compare(o1, o2) &gt; 0     - o1 is greater then o2
    public int compare(Customer o1, Customer o2) {
        return o1.getName().compareToIgnoreCase( o2.getName() );
    }
}</pre>
<p><span style="text-decoration:underline;">i.e.  Comparator class usage<br />
</span></p>
<pre>...

// create a copy of the unsorted customer list
List&lt;Customer&gt; <strong>sorted</strong>CustomerList = <strong>unsorted</strong>CustomerList;

// using the comparator class, sort the customer list
Collections.sort( <strong>sorted</strong>CustomerList, new CustomerByNameComparator() );
<span style="text-decoration:underline;">
</span>...<span style="text-decoration:underline;">

</span></pre>
<p><span style="color:#ff0000;"><strong>Solution 2 :</strong></span></p>
<p><span style="color:#ff0000;"><span style="color:#000000;">1) </span></span>Create a <strong>Comparator</strong> class for the desired entity.<span style="color:#ff0000;"><span style="color:#000000;"> </span><strong><span style="color:#000000;"> </span></strong></span></p>
<p><span style="color:#ff0000;"><span style="color:#000000;">2) Use this to create a <strong>TreeSet</strong> collection, sorted according to the comparator clas<span style="color:#000000;">s</span></span><strong><span style="color:#000000;">.</span></strong><span style="color:#000000;"> </span></span></p>
<p><span style="color:#ff0000;"><span style="color:#000000;"><span style="text-decoration:underline;">ie. TreeSet</span></span><span style="color:#000000;"><span style="color:#000000;"><span style="text-decoration:underline;"> collection example</span></span><br />
</span></span></p>
<pre><span style="color:#ff0000;"><span style="color:#000000;">...

// create a new treeset and instruct it on how to compare using above comparator
TreeSet&lt;Customer&gt; </span></span><strong>sorted</strong>CustomerList<span style="color:#ff0000;"><span style="color:#000000;"> = new TreeSet( new<strong> CustomerByNameComparator()</strong> );

// add the unsorted collection to new treeset to sort customer list
</span></span><strong>sorted</strong>CustomerList<span style="color:#ff0000;"><span style="color:#000000;">.addAll( </span></span><strong>unsorted</strong>CustomerList<span style="color:#ff0000;"><span style="color:#000000;"> );

...

</span></span></pre>
<p>Inshallah, that was not too complicated&#8230; Wa Allahu A&#8217;lam !!</p>
<p><span style="color:#ff0000;"><span style="color:#000000;"> </span></span></p>
<pre><span style="color:#ff0000;"><span style="color:#000000;">
</span></span></pre>
<div id="_mcePaste" style="overflow:hidden;position:absolute;left:-10000px;top:151px;width:1px;height:1px;">package com.astra.customer.util;</p>
<p>import com.astra.customer.model.Customer;<br />
import java.util.*;</p>
<p>public class CustomerByNameComparator implements Comparator&lt;Customer&gt;<br />
{<br />
// compare(o1, o2) &lt; 0     &#8211; o1 is less than o2<br />
// compare(o1, o2) == 0    &#8211; o1 is equal to o2<br />
// compare(o1, o2) &gt; 0     &#8211; o1 is greater then o2<br />
public int compare(Customer o1, Customer o2) {<br />
return o1.getName().compareToIgnoreCase( o2.getName() );<br />
}<br />
}</p></div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ibnaziz.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ibnaziz.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ibnaziz.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ibnaziz.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ibnaziz.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ibnaziz.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ibnaziz.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ibnaziz.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ibnaziz.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ibnaziz.wordpress.com/102/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ibnaziz.wordpress.com&blog=3722011&post=102&subd=ibnaziz&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ibnaziz.wordpress.com/2009/06/30/java-comparator-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f6e3bf313857892715911f2420425f0d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ibnaziz</media:title>
		</media:content>
	</item>
		<item>
		<title>Anti-Aliasing in Netbeans</title>
		<link>http://ibnaziz.wordpress.com/2009/06/10/netbeans-anti-aliasing/</link>
		<comments>http://ibnaziz.wordpress.com/2009/06/10/netbeans-anti-aliasing/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 01:37:47 +0000</pubDate>
		<dc:creator>ibnaziz</dc:creator>
				<category><![CDATA[Netbeans]]></category>
		<category><![CDATA[Netbeans Font Anti-Aliasing]]></category>

		<guid isPermaLink="false">http://ibnaziz.wordpress.com/2009/06/10/netbeans-anti-aliasing/</guid>
		<description><![CDATA[For some time now, the newer version of netbeans, no longer displays the "Advanced Options" that allows for anti-aliased fonts.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ibnaziz.wordpress.com&blog=3722011&post=91&subd=ibnaziz&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><span style="color:#ff0000;"><strong>Problem :</strong></span></p>
<p>For some time now, the newer version of netbeans, no longer displays the &#8220;Advanced Options&#8221; that allows for anti-aliased fonts. And frankly speaking, the fonts look terrible otherwise&#8230;<br />
<span style="color:#ff0000;"><strong> </strong></span></p>
<p><span style="color:#ff0000;"><strong>Solution :</strong></span></p>
<p>Manually edit the &#8216;netbeans.conf &#8216; file, located in the &#8216;/etc&#8217; folder, and add the switchs &#8216;-J-Dswing.aatext=true&#8217; and &#8216;-J-Dawt.useSystemAAFontSettings=on&#8217; to &#8216;netbeans_default_options&#8217; &#8230; !!</p>
<p>i.e.</p>
<pre>
# Options used by NetBeans launcher by default, can be overridden by explicit
# command line switches:
netbeans_default_options="-J-Dorg.netbeans.modules.tomcat.autoregister.token=1244593975203 -J-Dorg.netbeans.modules.tomcat.autoregister.catalinaHome=\"C:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.18\" -J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-XX:MaxPermSize=200m -J-Xverify:none -J-Dapple.laf.useScreenMenuBar=true -J-Dsun.java2d.noddraw=true -J-Dswing.aatext=true -J-Dawt.useSystemAAFontSettings=on"</pre>
<p>That&#8217;s all there is to it&#8230;</p>
<p>&#8230; waAllahu A&#8217;lam.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ibnaziz.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ibnaziz.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ibnaziz.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ibnaziz.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ibnaziz.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ibnaziz.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ibnaziz.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ibnaziz.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ibnaziz.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ibnaziz.wordpress.com/91/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ibnaziz.wordpress.com&blog=3722011&post=91&subd=ibnaziz&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ibnaziz.wordpress.com/2009/06/10/netbeans-anti-aliasing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f6e3bf313857892715911f2420425f0d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ibnaziz</media:title>
		</media:content>
	</item>
		<item>
		<title>DisplayTag &amp; alt=&#8221;&quot;</title>
		<link>http://ibnaziz.wordpress.com/2009/05/27/displaytag-alt/</link>
		<comments>http://ibnaziz.wordpress.com/2009/05/27/displaytag-alt/#comments</comments>
		<pubDate>Wed, 27 May 2009 05:05:31 +0000</pubDate>
		<dc:creator>ibnaziz</dc:creator>
				<category><![CDATA[DisplayTag]]></category>
		<category><![CDATA[XHTML]]></category>
		<category><![CDATA[display tag + alt]]></category>
		<category><![CDATA[display tag + title]]></category>
		<category><![CDATA[displaytag + alt]]></category>
		<category><![CDATA[displaytag + popup]]></category>
		<category><![CDATA[displaytag + title]]></category>
		<category><![CDATA[html alt]]></category>

		<guid isPermaLink="false">http://ibnaziz.wordpress.com/?p=86</guid>
		<description><![CDATA[Currently DisplayTag (ver 1.2) does not support the html 'alt' attribute... which can be quite annoying at times ! Nonetheless, there now seems to be a way around this...<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ibnaziz.wordpress.com&blog=3722011&post=86&subd=ibnaziz&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong><span style="color:#ff0000;">Context :</span></strong></p>
<p>Currently DisplayTag (ver 1.2) does not support the html &#8216;<em>alt</em>&#8216; attribute&#8230; which can be quite annoying at times ! Nonetheless, there now seems to be a way around this&#8230;</p>
<p><strong><span style="color:#ff0000;">Solution :</span></strong></p>
<p>To add &#8216;&lt;span title=&#8221;&#8230;&#8221;&gt;&lt;/span&gt;&#8217; (or any other html code for that matter) directly into the displaytag attributes (ie title) &#8230;</p>
<p>ie</p>
<pre>&lt;display:column title="&lt;span title='Customer Number'&gt;Cust. No.&lt;/span&gt;" ...&gt;</pre>
<p>&#8230; alhumdulillah !!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ibnaziz.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ibnaziz.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ibnaziz.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ibnaziz.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ibnaziz.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ibnaziz.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ibnaziz.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ibnaziz.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ibnaziz.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ibnaziz.wordpress.com/86/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ibnaziz.wordpress.com&blog=3722011&post=86&subd=ibnaziz&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ibnaziz.wordpress.com/2009/05/27/displaytag-alt/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f6e3bf313857892715911f2420425f0d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ibnaziz</media:title>
		</media:content>
	</item>
		<item>
		<title>JSTL to Java Scriplet</title>
		<link>http://ibnaziz.wordpress.com/2009/03/26/jstl-to-java-scriplet/</link>
		<comments>http://ibnaziz.wordpress.com/2009/03/26/jstl-to-java-scriplet/#comments</comments>
		<pubDate>Thu, 26 Mar 2009 03:46:54 +0000</pubDate>
		<dc:creator>ibnaziz</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[jstl]]></category>

		<guid isPermaLink="false">http://ibnaziz.wordpress.com/?p=82</guid>
		<description><![CDATA[When you want to use an EL variable exposed by a JSTL tag in an expression in the page's scripting language, you use the standard JSP element jsp:useBean to declare a scripting variable. <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ibnaziz.wordpress.com&blog=3722011&post=82&subd=ibnaziz&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong><span style="color:#ff0000;">Scope:</span></strong></p>
<p>When you want to use an EL variable exposed by a JSTL tag in an expression in the page&#8217;s scripting language, you use the standard JSP element <code class="cCode">jsp:useBean</code> to declare a scripting variable.<br />
<strong></strong></p>
<p><strong><span style="color:#ff0000;">Solution Example:</span></strong></p>
<pre>&lt;!-- first set the desired jstl variable and then export it to java --&gt;
&lt;c:set var="productGroup" value="${product.productGroup}"/&gt;
&lt;jsp:useBean id="productGroup" type="java.lang.Integer"/&gt;

&lt;!-- then simply access it in java --&gt;
&lt;%= ProductGroup.getDisplayName( productGroup ) %&gt;</pre>
<p>&#8230; that&#8217;s it.<br />
Wa&#8217;Allahu A&#8217;lam.</p>
<p><span style="color:#ff0000;"><strong><br />
</strong></span></p>
<p><span style="color:#ff0000;"><strong>References:</strong></span></p>
<p><a title="Using JSTL" href="http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSTL3.html">Using JSTL</a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ibnaziz.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ibnaziz.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ibnaziz.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ibnaziz.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ibnaziz.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ibnaziz.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ibnaziz.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ibnaziz.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ibnaziz.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ibnaziz.wordpress.com/82/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ibnaziz.wordpress.com&blog=3722011&post=82&subd=ibnaziz&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ibnaziz.wordpress.com/2009/03/26/jstl-to-java-scriplet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f6e3bf313857892715911f2420425f0d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ibnaziz</media:title>
		</media:content>
	</item>
		<item>
		<title>org.hibernate.AnnotationException: @OneToOne or @ManyToOne on xxx references an unknown entity: xxx</title>
		<link>http://ibnaziz.wordpress.com/2009/01/22/orghibernateannotationexception-onetoone-or-manytoone-on-xxx-references-an-unknown-entity-xxx/</link>
		<comments>http://ibnaziz.wordpress.com/2009/01/22/orghibernateannotationexception-onetoone-or-manytoone-on-xxx-references-an-unknown-entity-xxx/#comments</comments>
		<pubDate>Thu, 22 Jan 2009 07:29:36 +0000</pubDate>
		<dc:creator>ibnaziz</dc:creator>
				<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Netbeans]]></category>
		<category><![CDATA[@OneToOne or @ManyToOne on]]></category>
		<category><![CDATA[hibernate annotation exception]]></category>
		<category><![CDATA[org.hibernate.AnnotationException:]]></category>
		<category><![CDATA[references an unknown entity:]]></category>

		<guid isPermaLink="false">http://ibnaziz.wordpress.com/?p=66</guid>
		<description><![CDATA[During the process of converting the old hibernate xml heavy structure to the new annotation based structure, the following error was encountered after annotating one of the entity files...<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ibnaziz.wordpress.com&blog=3722011&post=66&subd=ibnaziz&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong><span style="color:#ff0000;">Context :</span></strong></p>
<p>During the process of converting the old hibernate xml heavy structure to the new annotation based structure, the following error was encountered after annotating one of the entity files&#8230;</p>
<pre>org.hibernate.AnnotationException: @OneToOne or @ManyToOne on com.project.entityone.model.EntityOne.addedBy references an unknown entity: com.project.entitytwo.model.EntityTwo</pre>
<p>&#8230; seemed like new annnotated entity was not being recognised by hibernate !</p>
<p><strong><span style="color:#ff0000;">Solution :</span></strong></p>
<p>1) Ensure that the entity has been appropriately referenced in hibernate.cfg.xml</p>
<p>ie</p>
<pre>&lt;hibernate-configuration&gt;
    &lt;session-factory&gt;
        ...
        <strong>&lt;mapping class="com.project.entitytwo.model.EntityTwo"/&gt;</strong>
        ...
    &lt;/session-factory&gt;
&lt;/hibernate-configuration&gt;</pre>
<p>2) Ensure that @Entity has been specified at the class-level ( at the top of the class )</p>
<p>ie.</p>
<pre><strong>@Entity
@Table( name="ENTITY_TWO" )</strong>
public class EntityTwo extends AbstractPersistanceClass
{
    ...</pre>
<p>Wa Allahu ‘Alam</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ibnaziz.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ibnaziz.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ibnaziz.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ibnaziz.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ibnaziz.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ibnaziz.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ibnaziz.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ibnaziz.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ibnaziz.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ibnaziz.wordpress.com/66/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ibnaziz.wordpress.com&blog=3722011&post=66&subd=ibnaziz&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ibnaziz.wordpress.com/2009/01/22/orghibernateannotationexception-onetoone-or-manytoone-on-xxx-references-an-unknown-entity-xxx/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f6e3bf313857892715911f2420425f0d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ibnaziz</media:title>
		</media:content>
	</item>
		<item>
		<title>Introduction to Hibernate Annotations</title>
		<link>http://ibnaziz.wordpress.com/2009/01/08/introduction-to-hibernate-annotations/</link>
		<comments>http://ibnaziz.wordpress.com/2009/01/08/introduction-to-hibernate-annotations/#comments</comments>
		<pubDate>Thu, 08 Jan 2009 08:27:52 +0000</pubDate>
		<dc:creator>ibnaziz</dc:creator>
				<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[Hibernate Annotations]]></category>

		<guid isPermaLink="false">http://ibnaziz.wordpress.com/?p=47</guid>
		<description><![CDATA[Simple article that describes the minimum steps required to convert a hibernate (and spring) project to start using hibernate annotations.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ibnaziz.wordpress.com&blog=3722011&post=47&subd=ibnaziz&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>During the process of upgrading hibernate settings to use annotations, the following steps were taken</p>
<p><em><strong>1) Adding the additional annotation related jar files:-</strong></em></p>
<p>* hibernate-annotations.jar<br />
* ejb3-persistence.jar</p>
<p><em><strong>2) Adding relevant annotations, and removing the old *.hbm.xml files, ie</strong></em></p>
<pre>a - @MappedSuperclass
b - @Entity
c - @Table(name="FOO_NAME")
d - @Transient
e - @Id

f - @Column(
 f.a - name="clmnName"
 f.b - nullable=true,
 f.c - unique=false,
 f.d - length=255,
 f.e - precision=256,
 f.f - scale=2
)

g - @Version
h - @ManyToOne
i - @JoinColumn( name="DATE_MODIFIED" )
j - @Temporal( TemporalType.TIMESTAMP )</pre>
<p>&#8212;&#8212;&#8212;&#8211;<br />
Index<br />
&#8212;&#8212;&#8212;&#8211;</p>
<p>a &#8211; for abstract entities that are used for extending entities<br />
b &#8211; for persistent entities<br />
c &#8211; optionally for specifying the table name, else default is to use entity name<br />
d &#8211; for non-persistent properties<br />
e &#8211; for the id property<br />
f &#8211; for ordinary properties that need to be mapped to the relevant table columns&#8230; please remember not required if only the default values are required for the following<br />
f.a &#8211; column name, not required if it is the same as the field property name<br />
f.b &#8211; default value of true<br />
f.c &#8211; default value of false<br />
f.d &#8211; default value of 255<br />
f.e &#8211; used for decimals numbers<br />
f.f &#8211; ie the sql equivalent NUMBERIC( percision, scale )<br />
g &#8211; for adding optimistic locking capability to an entity<br />
h &#8211; for &lt;many-to-one name=&#8221;&#8230;&#8221; column=&#8221;&#8230;&#8221; &#8230; /&gt; where an entity is used (within an entity) instead of primary data (ie int). Please note that the default fetching strategy for one-to-one and many-to-one is eager and that the strategy for one-to-many and many-to-many is lazy<br />
i &#8211; used in cases where the entity (within the entity) is stored in a seperate table and a join is required to link the two. If no name is specified the default behaviour is that a join column(s) will be created in the owner table and its name will be the concatenation of the name of the property in the owner side, _ (underscore), and the name of the primary key column(s) in the owned side.<br />
j &#8211; used for date and time</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
ALSO PLEASE NOTE:<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>i- annotations only need to be applied to getXXX and relevant isXXX methods&#8230; the rest (ie methods such as hasCode, toString) will be ignored even if marked with @Transient</p>
<p>ii- annotations can be marked on top of field properties or methods properties&#8230; but not both at the same time</p>
<p>iii- id properties are either assigned by the application or generated by the database&#8230; for application generated simply specifiy @Id&#8230; but for database generated preferably use @Id @GeneratedValue(strategy=GenerationType.AUTO)</p>
<p>iv &#8211; if specifying annotations (at the method level) for an entity that has certain (ie private) fields used only for internal purposes (ie NULL_VALUE = -1) that do not require persistance and as a result no relevent getters, please create a getter and label with @Transient</p>
<p>v &#8211; also please note that there is a difference between java annotations (ie @Override), spring annotations and hibernate annotations (used above), all three maybe used independently</p>
<p><em><strong>3) Modifying the Spring &amp; Hibernate Configurations</strong></em></p>
<p>i- create a seperate hibernate.cfg.xml file and place all the settings and mappings inside</p>
<p>==========================================================================================<br />
filename: hibernate.cfg.xml<br />
==========================================================================================</p>
<pre>&lt;!DOCTYPE hibernate-configuration SYSTEM "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"&gt;

&lt;hibernate-configuration&gt;

&lt;session-factory&gt;

&lt;!-- hibernate settings --&gt;
&lt;property name="dialect"&gt;org.hibernate.dialect.PostgreSQLDialect&lt;/property&gt;
&lt;property name="connection.isolation"&gt;2&lt;/property&gt;&lt;!-- READ_COMMITTED --&gt;
&lt;property name="show_sql"&gt;false&lt;/property&gt;
&lt;property name="use_sql_comments"&gt;false&lt;/property&gt;
&lt;property name="format_sql"&gt;true&lt;/property&gt;

&lt;!-- entity mapping files for old unconverted xml files to still work --&gt;
&lt;mapping resource="com/foo/entityold/model/EntityOld.hbm.xml"/&gt;
...

&lt;!-- annotated entities that don't require the respective hbm.xml files anymore --&gt;
&lt;mapping class="com.foo.entitynew.model.EntityNew"/&gt;

&lt;/session-factory&gt;

&lt;/hibernate-configuration&gt;</pre>
<p>ii- modify the spring context file</p>
<p>==========================================================================================<br />
foo-context.xml &#8211; Before Annotations<br />
==========================================================================================</p>
<p>&#8230;</p>
<pre>&lt;!-- session factory --&gt;
&lt;bean id="org.hibernate.SessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"&gt;

&lt;!-- data source --&gt;
&lt;property name="dataSource" ref="dataSource"/&gt;

&lt;!-- mapping resources --&gt;
&lt;property name="mappingResources"&gt;
&lt;list&gt;
&lt;value&gt;com/foo/entityold/model/EntityOld.hbm.xml&lt;/value&gt;
...
&lt;/list&gt;
&lt;/property&gt;

&lt;!-- hibernate properties --&gt;
&lt;property name="hibernateProperties"&gt;
&lt;props&gt;
&lt;!-- sql dialect --&gt;
&lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.PostgreSQLDialect&lt;/prop&gt;

&lt;!-- Set the JDBC transaction isolation level... 2 means TRANSACTION_REPEATABLE_READ - a constant indicating that dirty reads and non-repeatable reads are prevented; phantom reads can occur. --&gt;
&lt;prop key="hibernate.connection.isolation"&gt;2&lt;/prop&gt;

&lt;!--
Write all SQL statements to console. This is an alternative to setting the log category org.hibernate.SQL  to debug.
but please note that this is usually not necessary for production since the stack trace which also includes the particular SQL statement suffices
--&gt;
&lt;prop key="hibernate.show_sql"&gt;false&lt;/prop&gt;

&lt;!-- If turned on, Hibernate will generate comments inside the SQL, for easier debugging --&gt;
&lt;prop key="hibernate.use_sql_comments"&gt;false&lt;/prop&gt;

&lt;!-- Pretty print the SQL in the log and console --&gt;
&lt;prop key="hibernate.format_sql"&gt;false&lt;/prop&gt;
&lt;/props&gt;
&lt;/property&gt;
&lt;/bean&gt;</pre>
<p>&#8230;</p>
<p>==========================================================================================<br />
foo-context.xml &#8211; After Annotations<br />
==========================================================================================</p>
<p>&#8230;</p>
<pre>&lt;bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"&gt;

&lt;!-- data source --&gt;
&lt;property name="dataSource" ref="dataSource"/&gt;

&lt;!-- mapping resources and hibernate properties moved to hibernate.cfg.xml --&gt;

&lt;!-- new additions (for annotations to be enabled) --&gt;
&lt;property name="configLocation" value="classpath:hibernate.cfg.xml"/&gt;
&lt;property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration"/&gt;

&lt;/bean&gt;</pre>
<p>&#8230;</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ibnaziz.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ibnaziz.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ibnaziz.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ibnaziz.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ibnaziz.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ibnaziz.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ibnaziz.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ibnaziz.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ibnaziz.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ibnaziz.wordpress.com/47/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ibnaziz.wordpress.com&blog=3722011&post=47&subd=ibnaziz&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ibnaziz.wordpress.com/2009/01/08/introduction-to-hibernate-annotations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f6e3bf313857892715911f2420425f0d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ibnaziz</media:title>
		</media:content>
	</item>
		<item>
		<title>Exception: [.TableTag] Unable to reset response before returning exported data.</title>
		<link>http://ibnaziz.wordpress.com/2008/09/03/exception-tabletag-unable-to-reset-response-before-returning-exported-data/</link>
		<comments>http://ibnaziz.wordpress.com/2008/09/03/exception-tabletag-unable-to-reset-response-before-returning-exported-data/#comments</comments>
		<pubDate>Wed, 03 Sep 2008 03:13:18 +0000</pubDate>
		<dc:creator>ibnaziz</dc:creator>
				<category><![CDATA[DisplayTag]]></category>
		<category><![CDATA[XHTML]]></category>
		<category><![CDATA[Be sure that no other jsp tags are used before display:]]></category>
		<category><![CDATA[Exception: [.TableTag] + display:table]]></category>
		<category><![CDATA[Exception: [.TableTag] Unable to reset response before]]></category>
		<category><![CDATA[refer to the displaytag documentation on how to configu]]></category>
		<category><![CDATA[You are not using an export filter.]]></category>

		<guid isPermaLink="false">http://ibnaziz.wordpress.com/?p=44</guid>
		<description><![CDATA[When displaytag exports data in any non-html format, it needs to change the content type returned to the browser and reset any other content generated by the surrounding page.

Sometimes this can't be done: if content has already been sent back to the user, the response can't be reset and you get an error. This could happen because too many chars have been already written to the response, so that the response buffer was full and response has been automatically flushed. <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ibnaziz.wordpress.com&blog=3722011&post=44&subd=ibnaziz&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><span style="color:#ff0000;"><strong>Problem</strong><strong> :</strong></span></p>
<p>Exception: [.TableTag] Unable to reset response before returning exported data. You are not using an export filter. Be sure that no other jsp tags are used before display:table or refer to the displaytag documentation on how to configure the export filter (requires j2ee 1.3).</p>
<p><span style="color:#ff0000;"><strong>Context :</strong></span></p>
<p>When displaytag exports data in any non-html format, it needs to change the content type returned to the browser and reset any other content generated by the surrounding page.</p>
<p>Sometimes this can&#8217;t be done: if content has already been sent back to the user, the response can&#8217;t be reset and you get an error. This could happen because too many chars have been already written to the response, so that the response buffer was full and response has been automatically flushed.</p>
<p><span style="color:#ff0000;"><strong>Solution :</strong></span></p>
<p>Add the following to the page&#8230;</p>
<pre>&lt;%@ page buffer = "16kb" %&gt;</pre>
<p><span style="color:#ff0000;"><strong>Reference :</strong></span></p>
<p><a href="http://displaytag.sourceforge.net/10/export_filter.html">Export filter? What&#8217;s that?</a></p>
<p>&#8230; Wa Allahu A&#8217;lam</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ibnaziz.wordpress.com/44/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ibnaziz.wordpress.com/44/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ibnaziz.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ibnaziz.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ibnaziz.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ibnaziz.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ibnaziz.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ibnaziz.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ibnaziz.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ibnaziz.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ibnaziz.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ibnaziz.wordpress.com/44/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ibnaziz.wordpress.com&blog=3722011&post=44&subd=ibnaziz&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ibnaziz.wordpress.com/2008/09/03/exception-tabletag-unable-to-reset-response-before-returning-exported-data/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f6e3bf313857892715911f2420425f0d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ibnaziz</media:title>
		</media:content>
	</item>
	</channel>
</rss>