Skip to main content


Showing posts from June, 2011

Why I bought iPad1 after buying iPad2 ?

I needed a new Touch device for my 2yr old girl, though she already has an iPod Touch but she likes playing games and YouTube on my iPad 2 (bigger screen), so I thought of buying her a new touch device like an iPad.

Following were my requirements and options.

Touch device (bigger than iPod) with Toddler games and YouTube.Liter (Ultra Portable) and Durable (should last an year with ruff usage).Don't care for - Camera, Multitasking, Big CPU, RAM.Options

Device                    Price  Weight     Pros / Cons
iPad1                       349      680 g       Less expensive then others                          
                                                          Transfer purchased apps from iTunes
                                                          Same OS of iPad2 
Slower CPU, RAM

iPad2                       499      601 g     Transfer purchased apps from iTunes                                         
                                                          Great U…

Why companies don't launch Mobile/Touch products at same time in Asia ?

This question came recently in our daily meeting and my colleagues were explaining all the benefits of launching Mobile/Touch Products same time in US and in Asia (China, India, Middle East). These are the few points/advantages of introducing products same time in Asia.
Huge Consumer market ( 600 Millions) and is as mature as US.People love/admire for great products (Apple, Android, Samsung etc)Duty/Tax free destinations (Dubai etc)Seems a very potential market for launching products same time.So why biggies hold off their product for atleast 6 months before they really enter these markets and some people might argue its because of import/export regulations and shipment on the contrary all these products are assembled in Asia and these companies have bigger footprint in these markets.
People directly involved in these decisions are the right person the give us inside but here is my opinion.
Brand Building  Silicon Valley/USA is the best place to Build Brand cheaply i.e. you don't h…

How to use Jpa Hibernate Lifecycle Events Feature

Consider two possibilities to understand a typical usage and its not about Validation its all about Integration.      1. You wrote a Bug Tracking Application and deployed it at your client, client has a new requirement that when a new bug is created it wants to send its information to other internal System via Web Service.
   2. You wrote an Enterprise Application and a new features requires that when a new Product is added to database via JPA Hibernate its details should be sent to other departments via Web Service call.
And this is where the feature kick-ins.   We need to design and implement the capability with these features Scalable (should be able to use separate threat to do its job).Simple Design and Usable.Extendable i.e. No procedural junk code.Consider following design and Code snippet where Manufacturer and Product are JPA Entities and PartnerXNotifier and PartnerYNotifier are Web Service Clients.

public class Product implements S…

JPA Hibernate Lifecycle Callback Events Simple Explanation

Typical Entity Life-cycle

Persist   - Creating Entity for the first time.Merge    - Saving detached EntityLoad      - Loading Entity from DatabaseDelete    - Deleting Entity from Database

JPA provides total of 6 Annotations for Life-Cycle Callback events.


This is how we can use the above annotations.

Solution 1: Defining inside Entity class

Any method can be annotated with one or all annotations, though they should follow these rules.
 Method can have any name No parameters Return type of void Method should not be final or static No Checked exceptions should be thrown Any annotation can be only used on one method

Example Code Snippet - 1

public class Employee implements Serializable {

public void updateDate() {
    // this method will executed on all the lifecycle events.

Solution 2 : Using Entity Listeners Classes
This is very nice way of usin…