Skip to main content


Showing posts from December, 2010

Access multiple Databases in JPA

According to JPA specification we can define multiple "persistence-unit" elements (i.e. like below) in persistence.xml file and can easily refer them inside Dao layers as this.

public class PolarDaoImpl {

    protected EntityManager entityManager;


public class BearDaoImpl {
    @PersistenceContext(unitName="BearPU")     protected EntityManager entityManager;
-- }

Checkout sample persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="" xmlns:xsi="" xsi:schemaLocation="">
    <!-- Database 1 -->
    <persistence-unit name="PolarPU" transaction-type="RESOURCE_LOCAL">

Two point formula for Apple IPhone to outsell Android ?

Introduce multiple Iphones with a basic one costing around $100 so Carriers can give it for free in US, and in rest of the world most people can afford it, this can be very slim like IPod without any camera and special hardware, so regular user can enjoy web and touch screen.Introduce and Advertise more Geeky themes which young men would like, this is where Android is making inroad.This is for free -- Do something about Java on IPhone like how Google cleverly used it.

Running Liferay in Development Mode

Liferay speeds up rendering UI pages including Portlets by caching CSS, JS and layout files, this make developing portlets little painful, since every time you make js or css changes in your portlet and deploy. you may have to clear temp, work directoires and clear caches from Liferay control panel.

So when using Liferay for development we can switch off the caching by adding few properties to "" file, this will save some time and frustation when developing portlets

Solution 1 :
 Copy all values from to

Solution 2 :
 Copy below values to, location - webapps/ROOT/WEB-INF/classes/ if not present create a new one