I've found some simple solution for this problem. as i'm using gwt platform, I'm taking the help of SomeResult class (that implements Result Interface) instead of creating a new pojo class and populate it to client i'm creating a parameterised constructor in SomeResult that holds the db data and simply sends it to client.
the following is some sample code
public class SomeActionResult implements Result {
private String str;
private int myInt;
public SomeActionResult(String str,
int myInt){
this.str=str;
this.myInt=myInt;
}
//getters&setters
}
in hibernate i will be having a method that will return SomeActionResult(str,myInt)
public class MyDao{
public static SomeActionResult getData(){
//a hibernate query to retrieve the data and set them to str, myInt
retrun new SomeActionResult(str,myInt);
}
}
now in my SomeActionHandler class execute() method i'm calling getData() as following
public SomeActionResult execute(SomeAction action,ExecutionContext){
return MyDao.getData();
}