Wednesday, October 15, 2014

Refactoring: Why do we get into that situation in first place?

Refactoring is a process of modifying the code without changing the software behavior. Re factoring is required to make the design robust and flexible for future code modifications and more importantly increasing the code readability. In lifetime of software most of the times, the code is read than written or modified. More time required in reading/understanding the code than time taken to make the actual changes because modifying the code without understanding it property there lies the risk of introducing the new bugs.

I was just wondering why do we even get into the situation where we've to refactor the code? Well, this is tough question to answer. So my say is that the complexity of the software is directly proportional to the number of developers. While this is the fact, what if we have few developers(4 for example) who are always there to write and own the code and only those modify? Lets say that these four developers have been given the clear instruction that they have to follow all the design principles and guidelines that exist for object oriented languages. Over a period of time do we still get into the situation where we need to refactor the code? 

Before seeing what's the conclusion on above question, let me write some of the essential facts that happen in software life span especially in legacy software.

1. Different developers have different coding styles and different way of thinking this may happen due to developers being in different experience level. The same developers will not be there for ever to own the code. The extra time for correcting(refactoring) the old code is not planned/forgotten while making a fix, adding a new feature or during code reviews, the focus will be on the current issue being resolved than bothering about rest of the code 

2. No one initially designs the systems for better performance and future requirements. As a best practice, the systems are designed only to address the current requirements. And requirements change over the curse of time and you are bound to modify the code to accommodate the new requirements.

3. Sometimes performance comes at the cost of not following certain design guidelines. The straight example is that method calls are costlier but OO design guideline says that methods should be smaller. 

4. Lack of having sufficient unit test cases specially automated unit test cases. Unless the team is following TDD(Test Driven Development), the developers do not bother touching the code which does not solve the current issue.

So the discussion where in you hire expert developers with same experience level who will be writing the code from the scratch and also will be owning the code for future modifications. Does this team write and maintain the good quality code that does not have any code smells? We've not tried this but the opinion of many (with developing experience of more than 10 years) was No. There may come one of the above four aspects on the way and there could many code smells which are resolved by refactoring.

Though its impractical or tough task to have good quality code that follows all the OO design guidelines over a period of time, efforts to improve the code quality are advised. Refactoring can not happen overnight, and hence there we have introduced something called "Continuous refactoring"

Saturday, September 27, 2014

Good Technical Web Resources To Bookmark

During my study, I came across some useful web resources which I thought of sharing with you all. My intent is to have them all in one place for my reference so that I can always come to this post and browse when needed. I'm going to update this post if I come across any new web resources which I think worth booking marking. The readers of this blog can also have a look at  these resources. If you have any web resources which you think are good ones, you can leave a message against this post, I'll take a look and include those. Hope these resources benefit you all as well.

Design pattern & certification links:
OO principles: http://www.objectmentor.com/omSolutions/oops_what.html
UML, design patterns: http://sourcemaking.com/uml 
Strictly Singleton pattern: http://javarevisited.blogspot.in/2011/03/10-interview-questions-on-singleton.html
IBM UML certification: http://www-03.ibm.com/certify/tests/edu833.shtml

New tools/technology updates:
News about tools, mobile apps, cool websites: http://www.makeuseof.com/
Highly successful kickstarted project: https://www.kickstarter.com/projects/556341540/pressy-the-almighty-android-button . You can find someother cool projects here
MIT technology review: http://www.technologyreview.com/
Geekwire: www.geekwire.com/
Technology Advice, product review: www.thinkdigit.com
Engadget: www.engadget.com
Technology updates: www.gizmodo.com
Tech journals: www.gigaom.com
Java code geeks: http://www.javacodegeeks.com/

Understanding mechanics & engine:
Mechanical movements animated: http://507movements.com/mm_114.html 
Animated engines: http://www.animatedengines.com/index.html

Utility:
Sorting algorithms Animated: http://www.sorting-algorithms.com/
Compress photos without degrading quality: http://www.jpegmini.com/

Java Developer Links: http://www.cygnet-infotech.com/41-websites-every-java-developer-should-bookmark
Good Read: http://money.cnn.com/2013/11/21/leadership/steve-jobs-elon-musk.pr.fortune/index.html

Teaching, Training & Coaching: What's the difference between them?

We have come across these terminologies many a times in our day today activities. During our schooling, we were being taught. We had teachers. When we got job and joined an organization, we were trained. There were trainers.
We have seen many training/tutorial centers. The teaching and training are pretty much same with certain differences. Coaching is what something different than teaching and training. In this short post I'll explain how coaching is different from training/teaching with certain examples.

Well, teaching is vast and is carried out with the intent of guiding people to impart the knowledge on the subject. The students are instructed with examples and accumulated experience by the teachers. Teaching is more of theoretical in nature. The teacher creates awareness among the students on the subject matter to help them better understand the theories. This  is what is done in schools/colleges. Teaching is what is done in our academics and it is limited to that. 

The training by definition is form by instruction, discipline or to make prepare for a skill or test. This means that the  training is more practical than theoretical. It is specific to real world concepts which is immediately required by the participants for doing their job. The professional training involves reshaping the learning that we've got in our academics to the practical /real world problems. Organizations conduct training to their new employees to align them to the goal/vision/mission of that organization. Most the learning that we've got during schooling days may not be applicable here, but is more focused to what problems that organization is trying solve.

Where as coaching is different story and is very effective than teaching and training. Coaching is "putting the participants in the context of the problems, make them realize/feel the problems and prepare them to come up with solutions". Coaching depends solely on the participation of participants. Coach identifies the strength and weaknesses of participants and he/she guides what they can do to improve. So coaching is more individual oriented. 

You May Not Be The First But You Can Always Be The Best : Finding An Edge In The Market

Innovative organizations, people like you always be thinking/doing something new, it could be new product, solution, method, mobile app etc. But if you look at today's world, the idea you are thinking of doing, is already done and available in market or someone is working on the same idea or  someone has protected the Intellectual Property(IP) by filing patents. This is for some people can be a disappointing factor. According to me there is nothing much to worry here and back off. In this article I'll try to explain why we should not get disappointed and how to find a way forward.

There are examples where many start ups who have failed to be success because the idea they are working on is already there. They have failed by this only factor. And there are also examples wherein certain start ups are indeed success in what they were doing even when some had already done the same thing. If you dig deeper why is this then you will realize that the success is not about just having a great idea and working on it, its about the way its executed. Before getting into the execution part, let tell about what if your idea is already IP protected by some body. Here what people should be doing here is that study the patents carefully. The patents may not cover the exact idea as that of your sometimes. In this  case, frame your idea and protect it, you may have to consult IP lawyers for this. Secondly though companies/people have logged patents, but there is no product on that idea in the market due to several reasons. In this  case you can go for licensing it. You'll have to pay for this. If you believe that the licensing the idea and making that to the market is really going click, then only you need to go for since it involves monetary aspects.

Look at the examples. If you take smart phone companies as example, there are many companies that make phones. But yet iPhone is received by the people as the only best smart phone. All phones have the same feature. This tells that its how you make it. There is nothing important than user experience. And user experience is the base for word of mouth advertising.
Apple Inc. recently announced Apple Watch and this entered the crowded market, there were many smart wrist watches out there in the market, like pebble, for health monitoring, the FitBit was huge success. Of course there is some brand dominance to some extent, but its the user experience, ease of use is what it matters. Facebook was not the first one to have social networking site. Apple was not the first to bring the smart watch. But yet Apple watch is being received by the people very well.

So, perseverance is what really matters. Having an idea is just not enough its the continuous execution is what matters. Especially India based start ups face many hurdles due to the fact that different people mindset. Its difficult to convenience them, taking the idea globally may work. Some guidelines are if idea you are working on is already in the market, its not that you stop doing it, but look at the customers using it, what are they saying about the product, list down the cons they are talking about. Remember that we can always make products more easy to use. 

So the bottom line is that 'You may not be the first but you can always be the Best'.

Monday, September 22, 2014

Driving Culture Change In An Organization Effectively: Practices & Challenges

Organization culture is built over the period of time influenced by business model, customer interactions, leadership behavior. Since culture is built over time, difficult task to change. However once organization learns that the current culture in not helping achieve business objectives, the change becomes mandatory to cope up with new trends, market developments for the organization to survive and set the standards.

The cultural change boils down to people behaviors in the organization. We can change the processes easily but it is tough task to change people behavior. Culture change is a business challenge which has to happen collectively by joining hands with each other in organization. Some of the thoughts shared below.

What's the current situation/culture?: The current situation needs to be assessed carefully by focused discussions, listing down the people concerns, complaints, thoughts. Sufficient time needs to be spent here writing down all the assessment comments, clearly identifying the gaps, problems, come up with clear, simple vision/intent of the new change.

What is the new culture? Set the vision/intent of change needs be clearly mentioned and understood by all. Everyone has to be in agreement with the culture vision. Let all employees understand that and acknowledge & sign it. If any one does not agree to the vision, spend sufficient time talking to the person to understand the different opinion and see there is really a problem/hurdle in change objective.

Driving changes: The leadership needs to be decentralized, and as much as possible this has to be bottom up approach. Since any change boils down daily activities performed by employees, the top management may not well understand these bottom level issues. Hence the leadership needs to be decentralized/flattened to better understand, drive the change. Reorganization may not just help.

Coaching plays an important aspect: To effectively convince the employees,
they need to understand and realize what's going wrong with current organization culture. This can only be done through coaching and not by training. 

Hire an outsider to kick start the organization change, the employees listen to thoughts of a person who has newly joined the organization with vast experience in bringing the change. This simply works but existing employee's attempt to change the culture/process may not be effective or fail subsequently. This is  the reason for teaching new processes, the organization hires outside trainers and employees are trained outside the company campus sometimes!  

Track timely and closely the changes being deployed. It has to be very clear as to what people should be doing in daily activities since all the changes being driven boil down to daily activities. The change is truly in effect once new culture change becomes part of employees' DNA and no guidance, change drivers required. This is when we truly have self organized people/teams.

Saturday, September 20, 2014

Internet of Things (IoT) : New Business Opportunities & Challenges

IoT has been around for many years now and today it is the much talked topic and buzz word today. IoT just means that the "things" have capability to communicate with each other through wireless network technologies such as Wifi, Blue-tooth, ZigBee, NFC etc to understand each other and communicate over the internet to each other. The 'things' can be any thing from home appliances, tiny wearable computing devices such as watch, glass, shoes to animals!  Yes, you can track and understand your pets through devices tied to your pets.

Internet of things, in-fact its internet of everything is changing the way the internet is being used creating new business opportunities. Some examples of new business opportunities are such as real time monitoring your products, processes which can lead to predictive maintenance and operational efficiency. Your mission critical systems can be more real time and productive. Optimization in your supply chain management by having inventory tracking systems in real time. This improves the visibility of the products and processes and thus winning customer royalty. We can have great energy savings by monitoring the device performance. 

IoT has impacts in all types of businesses. This is simply because, as of today, there are many gaps which can be filled with IoT solutions. Not all the 'things' at homes communicate without human intervention. The human intervention can be completely avoided by delegating certain decision making processes to a connected device. For Example: The water pumping motor can be started automatically based on the communication from water level monitoring device in the water storage tank. A self learning thermostat such as Nest or Lyric turns off the cooling/heating when nobody is there at home.

IoT has numerous business opportunities in healthcare sector. Patients being at their home are still connected to their doctor. The wearables for patients monitor the patient health data and report to the doctor in real time. So doctors can monitor the patients remotely. When it comes to smart cities, the real advantage of IoT can exploited. The smart street lamps for example can be auto turned off when there are no moving objects there by saving electricity and smart speakers in public can make automatic announcements based the unusual people activities in public etc.

The challenges for IoT could be lack of internet connectivity everywhere. Some of the IoT solutions today are not necessarily needed. People can still live without it, however the advantages of IoT based solutions need to be realized by all the stakeholders. Google is already making effort in providing the internet everywhere by having new projects such Google Loon project, Google Internet Drone system etc. The internet usage is not free as of today and hope internet will be made free for all and thus increasing internet users and that's when IoT makes more sense and leads to unlimited business opportunities.

Wednesday, September 17, 2014

Wearable Technology: The Next Big Thing In Computing?

There seems to be different wave in the market when computing evolved to wearable technology from mobile computing. With Internet Of Things (IoT), the wearables (wearable devices) are gaining more and more popularity.The use cases are unlimited. Take any type of industry, be it consumer electronics, personal health care such as fitness, home automation, building automation, there are applications of wearables. The wearables could be in any form such as Wrist band/watch, glass, jewellery, belts, clothing, footwear, embedded etc. These wearables communicate and control in real time. This is changing the way people are communicating/sharing with one another boosting the personal relationships. This technology is bringing a kind of togetherness among the distant people. The wearable computing is creating new business opportunities with existing products or new products altogether and we can see companies are investing in this type of computing looking at its market trend. 

The reason for this kind of good trend in wearable technology is mainly because of the availability of low cost sensors consuming less power. The wearables themselves may not have all the required intelligence built in them but they do interact with other devices such as mobile, computer system for further data analytic and get appropriate actions back to wearables. The fact that the devices (home appliances, electronic devices, home/building controls, health care systems) can communicate with each over wireless network such as Wifi, Blue-tooth, Blue-tooth low energy (BLE), Near Field Communication(NFC) etc.

No doubt that the wearable technology is going to make human life easier, intuitive, productive and enjoying. Some of the examples include, the wrist wearables from Fitbit, Apple Watch  telling how much calories you've burnt, your heart rate, mobile payment (Good news for people who hate to carry too many cards), Google glass putting the information right at your eye taking voice commands as input. The next version of Google glass will be smart contact lenses that monitor your glucose levels in your tears. The diagnostic wearables measure your, heart rate, ECG,  blood pressure etc. Some wearables take gestures as input for processing. The uses are unlimited and left to your imaginations.

While wearable computing is gaining popularity and having good trends, there are challenges to tackle. The power for all wearables is a major challenge. This can be little relaxed if the wearable works on BLE that may run on a coin cell. Apart from this, there can be solar powered wearables. The next challenge is that are wearables increasing our day to day work such as people need to deal with many gadgets such as computer system, phone, tablet, etc. However looking at the advantages these limitations are not severe.


Tuesday, September 16, 2014

Android One Powered Affordable phones: What's the big nice about them?

'Android One' is program rolled out first in India by Google. In this program, google made a different version(a kind of stripped down version) of its regular Android operating System to work with low cost hardware. The challenge for Google was that several low end android phones have no way to get the OS updates, and hence they can't enjoy latest android features and apps. Android one has resolved this challenge and that's all about Android One Program. Google has teamed with different vendors (Spice, Micromax, Karbonn as of today) and have launched Android one program in India with price starting above 6K available through on-line retail stores.Google plans to expand Android One outside India as well, this could be through country specific phone vendors.  These devices get OS updates directly from Google whenever available.

The big international smart phone players such as Samsung, HTC, Sony etc,right now use the regular Android OS and put an extra layer of customized UI layer on top of it. These android OS can't directly get the OS updates from Google. The individual vendors need modify their customized android and then give update which takes time. Some vendors will not even promise any system updates once they are sold! And in-fact why vendor customization is what a differentiating factors among android smartphones  and gives competitive advantage. Using Android one vendors can't customize anything but just can make apps and sell the phones. 

Apart from  direct OS updates, low cost, there are other advantages of using Android One phones. People can watch YouTube videos offline. And if you are an Airtel customer, you will get android updates without any data charges(conditions may apply) and free app downloads from Google Play Store till 200 MB per month)

The question is that are international smart phone vendors going to start using Android One? Possibly yes but there is uncertainty about it. I'm guessing the Android version for this segment is called Android Silver, however as such there are no much details about it.

Monday, September 15, 2014

iPhone 6, Apple Watch: No Surprises Yet Gadgets Entering The Crowded Market

Apple Inc., announced two new phones iphone6, iPhone 6 plus & Apple Watch on 9th September. These new models just have bigger screens with edges curved than iPhone 4, iPhone5S with little thinner in size and nothing else. Apple had never liked the big screen phones, then probably they have managed to make big screen phones, this is  probably because market is crowded with big screen android phones and Apple never had big screens so far. The only new stuff with newly announced gadgets is 'Apple Pay' which is wireless mobile payment method. Apple claims that it has partnered with major credit card companies and  has  predicted that 83% of US transactions will happen by Apple Pay. Apple pay is the feature  for  which Apple mainly added NFC (Near Field Communication) to their phones.

These gadgets are entering the crowded market as apple has done nothing different than what rest of the companies are already doing. There are no surprises, excitements as such in these gadgets. The concept of smart watch is present from the year 1982. But yet Apple has made an attempt to better understand their customer needs. The differentiating factor may be the gadgets' design itself. These gadgets are really nicely made. The Apple Watches are just awesome. The apple watch has integrated with health kit. It measures your heart beat, how much you've walked, etc using 3 integrated sensors & using GPS. The Apple Pay may take the market share. The company plans to monetize Apple Pay transactions in the future generating the new stream of revenue.

Having talked about these wonderful smart gadgets, don't you think we've more work to do? Didn't get it? Now you'll have handle more gadgets. For example, you need to charge your Laptop, phone, watch and any other gadgets that you may have. I was just expecting that Apple will get away with too many gadgets that people need to deal with and just come up with a wearable technology and device that suffices all the smart phone work. This could have been really a surprise.

Saturday, September 13, 2014

Unsolved agricultural engineering problems: Can today’s technologies solve them?

Agriculture being backbone of India today is still suffering from man power. Less farmers day by day and more demand for agricultural products.  Less people going for this occupation because farming is difficult and there are non-predictive yields. However there are examples where in people doing non agriculture job have shifted to agriculture but they are very few.   The very major reason is that agriculture in India has many problems unresolved. Agriculture requires lot of workers, so not much things are automated. I've tried to list down those. These problems might have been solved in other countries or specific reasons in India also but are not very popular in all India rural areas.

1. No proper machinery to harvest the maize. Though there exist the mechanized systems for harvesting the maize, they do not serve the exact purpose. For example, the maize harvesting machine (called Combine), crushes the entire maize plant which is unwanted. That means that it does reaping, threshing & winnowing at once. However, no effective husking machinery being used in India. Husking is very time consuming and requires huge hand power. Though there are husking machines talked about in the world, they not effectively used by India farmers. Due to this reason, farmers have decreased growing maize because harvesting it involves lot of manual work and requires huge man effort. The bottom line is that we need effective machinery for husking the maize.



Maize is one example crop whose cultivation problem is talked about, this is true for other crops as well such as rice, wheat etc.



2. Irrigation Management: No solution/system for managing the water pumping motor.   

Hence we do not have easy way to do the following.
Whenever there is power supply, the system has to notify user through message or call. When the system is configured to auto start the motor on power supply, the system has to do the same and inform user on the action.
The system has to auto stop the motor when the motor is not pumping the water and send alert on the same. When the motor is not pumping the water, it consumes less electricity which is below the minimum required to pump the water. The system should also receive start/stop commands through phone and execute the same.

3. What are the best yielding crops? There is no system for deciding which

crops to grow. Sometimes the farmers will be a dilemma as to which crops to plant. There has to be a system that measures the soil quality and suggests what can be cultivated. The system also takes other parameters into account before deciding such as the weather prediction for the year, season, amount of water availability etc. 


4. Lack of Best Market:  Sometimes farmers won’t get the right price for their agricultural (farm) products. There is no system for finding the brokers/agents who give the best price for their hard work.


5. Lack of Connectivity & collaboration: Though government has taken some steps such as agriculture toll free number for farmers to get information related to agricultural activities, it is not enough. The farmers need more  connectivity with other farmers, government agencies, agricultural universities and collaboration system to get maximum advantage. 


The above few problems might have given you some thoughts as to kind of the problems that the farmers face today. Again, these solutions may be already present in other agriculturally advanced countries and in some states in India itself. However, these solutions are not reaching all farmers. So the question remains, can today's technologies solve agricultural problems in India and reach out to all Indian farmers?

Tuesday, September 9, 2014

Hibernate Getting Started From Scratch In 3 Simple Steps

This is the quick starter guide to get started with hibernate  framework with Java in 3 simple steps using Eclipse IDE. The guide explains the steps required right from scratch in Windows platform. In short the hibernate framework is based on Java and Object Relation Mapping(ORM) tool which significantly reduces the work otherwise while dealing with relational databases using programming languages. It is assumed that the reader knows MySql and Java Programming Language basics, if not its recommended to learn them first. Please refer to the post for getting started with MySQL and JAVA.

1. Hibernate Installation

Download hibernate files from http://sourceforge.net/projects/hibernate/files/ the latest version at present is 4.x. You'll get zipped file called "hibernate-release-4.3.1.Final", unzip this into your local hard drive. Under the unzipped folder, there is lib\required folder which is the core of hibernate framework.

2. Create a Simple Java Project in Eclipse

You've created a database and Employee table in MySQL in the previous post. If not you need do that first. Add all the required hibernate jar files that you downloaded in the step1 to eclipse project build path.

2.1 Create a class called "Employee.java" which is a model class that is going to be mapped to Employee database table as shown below.



import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "employee")

public class Employee implements Serializable{
       private static final long serialVersionUID = 1L;
       @Id
       @GeneratedValue
       @Column (name="empid")
       private int empId;
      
       @Column(name="firstname")
       private String firstName;
      
       @Column (name="lastname")
       private String lastName;
      
       @Column (name="cubicle")
       private String cubile;

       public int getEmpId() {
              return empId;
       }
       public void setEmpId(int empId) {
              this.empId = empId;
       }
       public String getFirstName() {
              return firstName;
       }
       public void setFirstName(String firstName) {
              this.firstName = firstName;
       }
       public String getLastName() {
              return lastName;
       }
       public void setLastName(String lastName) {
              this.lastName = lastName;
       }
       public String getCubile() {
              return cubile;
       }
       public void setCubile(String cubile) {
              this.cubile = cubile;
       }
}


2.2 Create hibernate configuration file called hibernate.cfg.xml in source folder of your eclipse project with contents as shown below. This config file has information about connectivity driver, url, db credentials etc and importantly mappings from Java class to MySQL database table.


<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
        <!-- Database connection settings -->
        <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/mydatabase</property>
        <property name="hibernate.connection.username">root</property>
        <property name="hibernate.connection.password">your_password</property>
<property name="hibernate.connection.pool_size">10</property>

    <property name="show_sql">true</property>
    <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
    <property name="hibernate.current_session_context_class">thread</property>
   
    <mapping class="Employee"/>
   
    </session-factory>

</hibernate-configuration>

2.3 Create a utility class that creates hibernate session factory as shown below.


import org.hibernate.SessionFactory;
import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
public class HibernateUtil {
       private static final SessionFactory sessionFactory;
       static{
              try{
                     Configuration cfg = new Configuration().configure("hibernate.cfg.xml");
                     StandardServiceRegistryBuilder sb= new StandardServiceRegistryBuilder();
                     sb.applySettings(cfg.getProperties());
                     StandardServiceRegistry standardServiceRegistry = sb.build();
                     sessionFactory = cfg.buildSessionFactory(standardServiceRegistry);
              }catch(Throwable th){
                     System.out.println("Session factory creation failed...");
                     throw new ExceptionInInitializerError(th);
              }
       }

       public static SessionFactory getSessionFactory(){
              return sessionFactory;
       }
}

2.4 Now create HelloWorld Java program as shown below that uses the hibernate session factory, begins the transaction and displays contents from "Employee" table.

import java.util.Iterator;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
public class HibernateHelloWorld {
       public static void main(String[] args) throws Exception{
              SessionFactory sessionFactory  = HibernateUtil.getSessionFactory();
              Session session = sessionFactory.getCurrentSession();
              org.hibernate.Transaction tr= session.beginTransaction();
              Query query = session.createQuery("from Employee");
              List list = query.list();
              for(Iterator i=list.iterator();i.hasNext();){
                     Employee employee = (Employee)i.next();
                     System.out.println("Employee name=="+ employee.getFirstName());
              }
              tr.commit();
              sessionFactory.close();
       }
}

3. Run HelloWorld Java program as Java Application and see the console for the result as shown below.

INFO: HHH000399: Using default transaction strategy (direct JDBC transactions)
Sep 9, 2014 8:51:28 PM org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init>
INFO: HHH000397: Using ASTQueryTranslatorFactory
Hibernate: select employee0_.empid as empid1_0_, employee0_.cubicle as cubicle2_0_, employee0_.firstname as firstnam3_0_, employee0_.lastname as lastname4_0_ from employee employee0_
Employee name==John
Related Posts Plugin for WordPress, Blogger...