Guys,
Can any one of you help me to find the way for assigning the db result into bean class through hbm.xml file?
I am executing the stored procedure and getting result in DAO class. Then the result is assigned into the properties of one bean class through the setter methods.
DAO Code:
List apsList = query.list();
APSReportVO vo = new APSReportVO();
List apsReport = new ArrayList();
Code:
for(int i=0;i<apsList.size();i++) {
String data = apsList.get(i).toString();
if(data != null) {
data = data.substring(1, data.length()-1);
// data --->> [Lon, 014, 130]
StringTokenizer token = new StringTokenizer(data, ",");
vo.setBranchCode(token.nextToken());
vo.setSourceSystemID(token.nextToken());
vo.setTransactionID(token.nextToken());
apsReport.add(record);
}
}
Here i am getting the column values from every record using StringTokenizer and assigning into vo.
How to assign the column values to bean properties through hbm.xml file?
So we can avoid the following code in DAO class.
Code:
StringTokenizer token = new StringTokenizer(data, ",");
vo.setBranchCode(token.nextToken());
vo.setSourceSystemID(token.nextToken());
vo.setTransactionID(token.nextToken());
apsReport.add(record);
Can any one of you help me to find the way for this issue?