81,092
社区成员
发帖
与我相关
我的任务
分享
public List findOtByLine(String lineId, String dateId) {
List list = this
.getHibernateTemplate()
.find(
"select new com.bean.Otbyline(o.emp.empId,o.emp.empName,sum(o.nshift),sum(o.nmeal),sum(o.otNum1),sum(o.otNum2)) from Ot as o where o.emp.org.lineId='"
+ lineId
+ "' and o.dateId >'"
+ dateId
+ "' group by o.emp.empId");
return list;
}
17:37:37,778 ERROR PARSER:33 - Unable to locate appropriate constructor on class [com.bean.Otbyline]
[cause=org.hibernate.PropertyNotFoundException: no appropriate constructor in class: com.bean.Otbyline]
2009-8-7 17:37:37 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet default threw exception
org.hibernate.hql.ast.QuerySyntaxException: Unable to locate appropriate constructor on class [com.bean.Otbyline] [select new com.bean.Otbyline(o.emp.empId,o.emp.empName,sum(o.nshift),sum(o.nmeal),sum(o.otNum1),sum(o.otNum2)) from com.bean.Ot as o where o.emp.org.lineId='L18' and o.dateId >'2009-06-10' group by o.emp.empId]
public class Otbyline implements java.io.Serializable {
private static final long serialVersionUID = 1L;
private int empid;
private String empname;
private int nshift;
private int nmeal;
private float ot1;
private float ot2;
// Constructors
/** default constructor */
public Otbyline() {
}
/** full constructor */
public Otbyline(int empid, String empname, int nshift, int nmeal,
float ot1, float ot2) {
this.empid = empid;
this.empname = empname;
this.nshift = nshift;
this.nmeal = nmeal;
this.ot1 = ot1;
this.ot2 = ot2;
}
public int getEmpid() {
return empid;
}
public void setEmpid(int empid) {
this.empid = empid;
}
public String getEmpname() {
return empname;
}
public void setEmpname(String empname) {
this.empname = empname;
}
public int getNshift() {
return nshift;
}
public void setNshift(int nshift) {
this.nshift = nshift;
}
public int getNmeal() {
return nmeal;
}
public void setNmeal(int nmeal) {
this.nmeal = nmeal;
}
public float getOt1() {
return ot1;
}
public void setOt1(float ot1) {
this.ot1 = ot1;
}
public float getOt2() {
return ot2;
}
public void setOt2(float ot2) {
this.ot2 = ot2;
}
}
public class Otbyline implements java.io.Serializable {
private static final long serialVersionUID = 1L;
private Emp emp;
private int nshift;
private int nmeal;
private float ot1;
private float ot2;
// Constructors
/** default constructor */
public Otbyline() {
}
/** full constructor */
public Otbyline(Emp emp, int nshift, int nmeal,
float ot1, float ot2) {
this.emp = emp;
this.nshift = nshift;
this.nmeal = nmeal;
this.ot1 = ot1;
this.ot2 = ot2;
}
public Emp getEmp() {
return emp;
}
public void setEmp(Emp emp) {
this.emp = emp;
}
public int getNshift() {
return nshift;
}
public void setNshift(int nshift) {
this.nshift = nshift;
}
public int getNmeal() {
return nmeal;
}
public void setNmeal(int nmeal) {
this.nmeal = nmeal;
}
public float getOt1() {
return ot1;
}
public void setOt1(float ot1) {
this.ot1 = ot1;
}
public float getOt2() {
return ot2;
}
public void setOt2(float ot2) {
this.ot2 = ot2;
}
}
select distinct new com.lenovo.mfgot.bean.Otbyline(o.emp,o.nshift,o.nmeal,o.otNum1,o.otNum2) from Ot as o where o.emp.org.lineId='"
+ lineId
+ "' and o.dateId >'"
+ dateId
+ "' group by o.emp.empId");
select distinct new com.lenovo.mfgot.bean.Otbyline(o.emp,sum(o.nshift),sum(o.nmeal),sum(o.otNum1),sum(o.otNum2)) from Ot as o where o.emp.org.lineId='"
+ lineId
+ "' and o.dateId >'"
+ dateId
+ "' group by o.emp.empId");