I have been using Eclipse IDE since 2006 and I liked it so much for various reasons. First it is open source and free to use. Eclipse looks pretty neat on Windows OS on which I work most of the time. Occasionally I tried to use NetBeansIDE (before 6.x version) and I didn’t like it because it’s too slow. And I never tried IntellijIDEA because it’s a commercial product and I am 100% sure that my employer is not going to pay $$$ for an IDE.
Continue reading »Clean Code: Don’t mix different levels of abstractions
We spend more time on reading code than writing. So if the code is more readable then obviously it will increase the developer productivity. Many people associate readability of code with coding conventions like following standard naming conventions, closing file, DB resources etc etc. When it comes to code reviews most of the people focus on these trivial things only, like checking for naming convention violations, properly releasing resources in finally block or not.
Continue reading »PrimeFaces Beginner’s Guide book published
I am glad to announce that my second book PrimeFaces Beginner’s Guide is published. As many of us know PrimeFaces is leading JSF component library for JSF based web applications. This PrimeFaces Beginner’s Guide book targets the Java developers with basic knowledge on JSF and jQuery and covers most of the commonly used PrimeFaces components. Good news is that PrimeFaces Beginner’s Guide book covers the latest PrimeFaces 4.0 version features such as Client Side Validations (CSV) framework: Dialog Framework, Search Expressions, Sticky Component and many other enhancement as well.
Continue reading »Packt Publishing “Java Persistence With MyBatis3” published
Hurray…My first book Java Persistence with MyBatis3 is published. I would like to thank Packt Publishers for giving me this opportunity to write on my favorite framework MyBatis. For most of the software applications data persistence is a key and important aspect. In Java land we have many ways of implementing persistence layer starting from low level JDBC to fancy ORM frameworks. JDBC is too low level API and needs to write a lot of boilerplate code.
Continue reading »A bunch of Maven Archetypes for Spring based Projects
Maven is a good project management tool which greatly reduces the amount of time we spend on creating java projects with proper structure. With so many predefined maven archetypes it is even easier to create projects by simply selecting the archetype based on the technologies we need and type(jar/war/ear) of project we want to create. However sometimes those predefined archetypes structure may not suite well for our needs or we may need some more additions to the pre-configured dependencies/frameworks etc.
Continue reading »MyBatis Tutorial : Part4 – Spring Integration
<strong>MyBatis Tutorial: Part1 – CRUD Operations</strong> <strong>MyBatis Tutorial: Part-2: CRUD operations Using Annotations</strong> <strong>MyBatis Tutorial: Part 3 – Mapping Relationships</strong> <strong>MyBatis Tutorial : Part4 – Spring Integration</strong> MyBatis-Spring is a sub-project of MyBatis and provides Spring integration support which drastically simplifies the MyBatis usage. For those who are familiar with Spring’s way of Dependency Injection process, using MyBatis-Spring is a very simple. First let us see the process of using MyBatis without Spring.
Continue reading »MyBatis Tutorial: Part 3 – Mapping Relationships
In this post let us see how to use MyBatis ResultMap configuration to map relationships. <strong>MyBatis Tutorial: Part1 – CRUD Operations</strong> <strong>MyBatis Tutorial: Part-2: CRUD operations Using Annotations</strong> <strong>MyBatis Tutorial: Part 3 – Mapping Relationships</strong> <strong>MyBatis Tutorial : Part4 – Spring Integration</strong> To illustrate we are considering the following sample domain model: There will be Users and each User may have a Blog and each Blog can contain zero or more posts.
Continue reading »MyBatis Tutorial: Part-2: CRUD operations Using Annotations
In this post I will explain how to perform CRUD operations using MyBatis Annotation support without need of Queries configuration in XML mapper files. <strong>MyBatis Tutorial: Part1 – CRUD Operations</strong> <strong>MyBatis Tutorial: Part-2: CRUD operations Using Annotations</strong> <strong>MyBatis Tutorial: Part 3 – Mapping Relationships</strong> <strong>MyBatis Tutorial : Part4 – Spring Integration</strong> Step#1: Create a table BLOG and a java domain Object Blog. CREATE TABLE blog ( blog_id int(10) unsigned NOT NULL auto_increment, blog_name varchar(45) NOT NULL, created_on datetime NOT NULL, PRIMARY KEY (blog_id) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; package com.
Continue reading »MyBatis Tutorial: Part1 – CRUD Operations
MyBatis is an SQL Mapper tool which greatly simplifies the database programing when compared to using JDBC directly. <strong>MyBatis Tutorial: Part1 – CRUD Operations</strong> <strong>MyBatis Tutorial: Part-2: CRUD operations Using Annotations</strong> <strong>MyBatis Tutorial: Part 3 – Mapping Relationships</strong> <strong>MyBatis Tutorial : Part4 – Spring Integration</strong> Step1: Create a Maven project and configure MyBatis dependencies. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.sivalabs</groupId> <artifactId>mybatis-demo</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>mybatis-demo</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <build> <plugins> <plugin> <groupId>org.
Continue reading »Keep The Code Clean: WatchDog & SpotTheBug Approach
Before going to discuss WatchDog & SpotTheBug Approach, let me give a brief context on what is the needs for this. Three months back I was asked to write core infrastructure code for our new application which uses all the latest and greatest technologies. I have written the infrastructure code and implemented 2 usecases to demonstrate which logic should go into which layer and the code looks good(atleast to me :-)).
Continue reading »