当前位置:编程学习 > JAVA >>

HQL new Object(...)onetomany错误求救?

org.hibernate.hql.ast.QuerySyntaxException: Unable to locate appropriate constructor on class [com.bjpowernode.drp.base.domain.Client] [select new Client(c.id,c.clientId,c.name,c.bankAccN,c.contactTel,c.address,c.zip,clevels) from com.bjpowernode.drp.base.domain.Client c left join c.clevels clevels  where c.id=?]这是hql:
String hql="select new Client(c.id,c.clientId,c.namec.bankAccN,c.contactTel,c.address,c.zip,clevels) from Client c left join c.clevels clevels  where c.id=?";

class Clinet{
private String name()
private Set<Clevel> clevels;
...
get**(){

}
set**(){
}
public Client(int id, String clientId, String name,
String bankAccN, int contactTel, String address, int zip, Set<Clevel> clevels) {
super();
this.id = id;
this.clientId = clientId;
this.name = name;
this.bankAccN = bankAccN;
this.contactTel = contactTel;
this.address = address;
this.zip = zip;
this.clevels = clevels;
}
}
class Clevel {
''''
} --------------------编程问答-------------------- 这个主要是没有找到构造方法仔细找下就可以了 --------------------编程问答-------------------- public Client(int id, String clientId, String name,
String bankAccN, int contactTel, String address, int zip, Set<Clevel> clevels) {
super();
this.id = id;
this.clientId = clientId;
this.name = name;
this.bankAccN = bankAccN;
this.contactTel = contactTel;
this.address = address;
this.zip = zip;
this.clevels = clevels;
} --------------------编程问答-------------------- 构造方法是有的,且属性与hql中的一致 --------------------编程问答-------------------- 除
补充:Java ,  Java EE
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,