gpt4 book ai didi

java.lang.IllegalArgumentException : Unknown parameter name : Diagnosticcentreid

转载 作者:行者123 更新时间:2023-12-02 12:16:47 32 4
gpt4 key购买 nike

我尝试使用输入参数 Diagnosticcentreid 调用 API 并收到错误

java.lang.IllegalArgumentException:未知参数名称:Diagnosticcentreid

我的错误在哪里,有人可以帮助我吗?

public List<DiagnosticDoctor> getDiagnosticdoctor(int Diagnosticcentreid){
Session session = SessionUtil.getSession();
Query query = session.createSQLQuery("SELECT d.diagnosticcentreid, d.doctorname, d.specializationname, d.tagline, d.clinicname, d.daysname, d.time\n" +
" FROM diagnosticdoctormapping ddm, doctor d where d.diagnosticcentreid = :ddm.Diagnosticcentreid");
query.setInteger("Diagnosticcentreid", Diagnosticcentreid);
List<Object[]> dataList = query.list();
List<DiagnosticDoctor> diagnosticDoctorList =new ArrayList<DiagnosticDoctor>();

for(Object[] obj:dataList){
DiagnosticDoctor dt = new DiagnosticDoctor();
dt.setDiagnosticcentreid(Integer.parseInt(String.valueOf(obj[0])));
dt.setDoctorname(obj[1].toString());
dt.setSpecializationname(obj[2].toString());
dt.setTagline(obj[3].toString());
dt.setClinicname(obj[4].toString());
dt.setDaysname(obj[5].toString());
dt.setTime(obj[6].toString());

diagnosticDoctorList.add(dt);
}
session.close();
return diagnosticDoctorList;
}

这是我的资源类:

  @Path("/getdoctor/{Diagnosticcentreid}")
@Produces("application/json")
public Response getDiagnosticdoctor(@PathParam("Diagnosticcentreid") int Diagnosticcentreid) {
DiagnosticDoctorMappingDAO dao = new DiagnosticDoctorMappingDAO();
List dtm = dao.getDiagnosticdoctor(Diagnosticcentreid);
String json = new Gson().toJson(dtm);
return Response.ok().entity(json.toString()).build();
}

最佳答案

将你的sql更改为

Query query = session.createSQLQuery("SELECT d.diagnosticcentreid, d.doctorname, d.specializationname, d.tagline, d.clinicname, d.daysname, d.time\n" +
" FROM diagnosticdoctormapping ddm, doctor d where d.diagnosticcentreid = :Diagnosticcentreid");

请注意“ddm”的删除。

关于java.lang.IllegalArgumentException : Unknown parameter name : Diagnosticcentreid,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46110331/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com