我收到错误消息
nested exception is org.hibernate.QueryException: could not resolve property:
compositKey of: com.thetasp.tu.data.TuSegCreditExposure
[from com.thetasp.tu.data.TuSegCreditExposure c where c.compositKey.rptRefNo=? and
c.ic=?]
在这里我正在查询并获得异常
public List<Object> findSegObjByRptRefNo(String rptRefNo, Class className,
String[] fields, String[] values) {
StringBuffer buff = new StringBuffer();
String sql = "from " + className.getName() + " c
where c.compositKey.rptRefNo=?";
buff.append(sql);
if (fields != null) {
for (int i = 0; i < fields.length; i++) {
String field = fields[i];
buff.append(" and c." + field + "=?");
}
}
Object[] argument = new Object[values.length + 1];
argument[0] = rptRefNo;
for (int i = 1; i <= values.length; i++) {
argument[i] = values[i - 1];
System.out.println(argument[i]);
}
try {
List<TuSegCreditExposure> exList = getHibernateTemplate().find(
buff.toString(), argument);
} catch (Exception e) {
String message = e.getMessage();
System.out.println(e.getStackTrace());
}
return getHibernateTemplate().find(buff.toString(), argument);
}
这条线给了我错误
List<TuSegCreditExposure> exList = getHibernateTemplate().find(buff.toString(),
argument);
为什么我收到此错误。
这是我的 TuSegCreditExposue 类
public class TuSegCreditExposure extends AbstractArchivableObj implements Serializable {
private TuSegCompositeKey compositeKey;
private String totalAccountsRevolv;
....
}
请告诉我为什么我得到这个例外。我做错了什么?
谢谢