I got an exception by hibernate which is,
"Caused by: org.hibernate.hql.ast.QuerySyntaxException: Unable to locate appropriate constructor on class"
My query is "Select new example.ReportField(r.memberName, r.address) from Member r"
public class ReportField { public List<String> fieldValueList = new ArrayList<String>(); public ReportField(Object... fields){ System.out.println("-----ReportField------" ); if (fields != null) { for (Object field : fields) { String fieldStr = field.toString(); String[] temp = fieldStr.split(":"); System.out.println("temp.length = " + temp.length); if (temp != null && temp.length == 2 && "uuid".equals(temp[0].toLowerCase())) { fieldValueList.add(SysUtil.getNodeByUUID(temp[1])); } else { fieldValueList.add(fieldStr); } } } }
public List<String> getFieldValueList() { return fieldValueList; }
public void setFieldValueList(List<String> fieldValueList) { this.fieldValueList = fieldValueList; } }
If I change the consturctor to public ReportField(String memberName, String memberAddress) and it works
Thanks
|