Hi,
I am firing a query in which i want to extract the "calling number","called number" and count of "called number" from database.
I've written the following query ---
Code:
public List getCallDetsForReport(Map objectArgs)
{
logger.info("start of call details records");
List dataList = null;
try
{
String callingNum = (String)objectArgs.get("callingNumber");
callingNum = "9829576509";
Session hibSession = getSession();
Criteria criteria = hibSession.createCriteria(HdCallDetailRecords.class);
criteria.setProjection(Projections.projectionList()
.add(Projections.property("callingNumber").as("callingNum"))
.add(Projections.property("calledNumber").as("calledNum"))
.add(Projections.count("calledNumber").as("countCalled"))
.add(Projections.groupProperty("calledNumber"))
);
criteria.add(Restrictions.eq("callingNumber",callingNum));
criteria.setResultTransformer(new AliasToBeanResultTransformer(CallDetailsRecCustomVO.class));
dataList = criteria.list();
System.out.println("the list size here is "+dataList.size());
}
catch(Exception e)
{
logger.error("the error has occured"+e);
e.printStackTrace();
}
return dataList;
}
The custom VO Class looks like this --
Code:
public class CallDetailsRecCustomVO
{
private String callingNum;
private String calledNum;
private Integer countCalled;
/**
* @return the calledNum
*/
public String getCalledNum() {
return calledNum;
}
/**
* @param calledNum the calledNum to set
*/
public void setCalledNum(String calledNum) {
this.calledNum = calledNum;
}
/**
* @return the callingNum
*/
public String getCallingNum() {
return callingNum;
}
/**
* @param callingNum the callingNum to set
*/
public void setCallingNum(String callingNum) {
this.callingNum = callingNum;
}
/**
* @return the countCalled
*/
public Integer getCountCalled() {
return countCalled;
}
/**
* @param countCalled the countCalled to set
*/
public void setCountCalled(Integer countCalled) {
this.countCalled = countCalled;
}
as clear from above code snippets, i want to populate the custom vo with the folowing details --
1. calling number.
2.called number
3. no of calls from calling number to called number.
On executing this query it gives me an exceptionsaying arguement mismatch while applying setter of "countCalled" property of my "CallDetailsRecCustomVO " . can someone help me in this regard ???