首页 > 解决方案 > org.hibernate.hql.ast.QuerySyntaxException:期待关闭,发现

问题描述

我正在执行休眠查询。它会产生以下错误。当从 SQL 工作台执行查询时,它会产生预期的结果。

List<Object[]> studentResult = new ArrayList<Object[]>();
        String queryStudentResult = "select sd.student_id,sd.name,sd.email_address,sd.phone_number,sd.dob,sd.gender ,st.test_score,CAST(st.test_score AS DECIMAL(4,2))/CAST(st.total_max_score AS DECIMAL(4,2))*100 AS testscore,std.percentage,std.college_name,std.college_city,std.college_state,rd.Degree,rb.branch_Name,se.10_percentage,se.12_percentage " + 
                " from student_details sd " + 
                "inner join student_test_completion st on sd.student_id=st.student_id " + 
                "inner join student_login sl on sl.student_id=sd.student_id " + 
                "inner join test_details td on td.test_id =sl.test_id  " + 
                "inner join category c on c.category_id =td.category_id  " + 
                "inner join student_degree_details std on std.stu_degree_id = (select stu_degree_id  from student_degree_details where  student_id= st.student_id LIMIT 1 ) " + 
                "inner join registration_degree rd on rd.Degree_ID= std.degree " + 
                "inner join registration_branch rb on rb.branch_Id= std.branch " + 
                "inner join student_education se on se.student_id=sd.student_id  " + 
                "where CAST(st.date_of_test as date) between ? and ? and st.college_name=?  " + 
                "and c.category_name='Assessment' and std.isCurrent_degree=1 ";
        Object[] queryParam = {date1,date2,testdetails.getCollege_name()};

        studentResult = template.find(queryStudentResult, queryParam);

student_id LIMIT 1 ) rd.Degree_ID 上的内连接registration_degree rd=std.degree 内连接registration_branch rb 上的rb.branch_Id= std.branch 内连接student_education se on se.student_id=sd.student_id 其中CAST(st.date_of_test as date) 之间? 和 ?和 st.college_name=? 和 c.category_name='Assessment' 和 std.isCurrent_degree=1 ] 在 org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:54) 在 org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java :47)

标签: hibernate

解决方案


推荐阅读