开发者

query.list gives wrong result for sqlquery

I have one sqlquery which works fine when pasted to sql server explorer, but when hibernate query.list call is made the list gives me zero size list.开发者_JS百科 Below is the code:

Query query = session.createSQLQuery(sqlQuery); List<Object[]> list = query.list();

This was working fine suddenly it started behaving strange.

Thanks, Punam Purohit


What was the SQL query? Hopefully it was a SELECT statement. Did you make any changes to the Hibernate config files or mapping files (if you are using Hibernate entities)? We'll need more information.


@Joshua Witter

SELECT DISTINCT doc.id, c_user.contractor_name, c_user.company_id,doc.status, doc.date_submission, dim.name div_name, gt.grade_name, dept.name dept_name FROM contractor_user_master_ipms c_user, document_metadata dmd, division_master dim, document doc LEFT OUTER JOIN selected_grade_map sgm ON doc.id = sgm.doc_id LEFT OUTER JOIN selected_grade_details sgd ON sgm.selected_grade_id = sgd.selected_grade_id LEFT OUTER JOIN code_master cm ON sgd.sub_code_id = cm.code_id LEFT OUTER JOIN department_master dept ON cm.department_id = dept.id LEFT OUTER JOIN grade_master gm ON sgd.grade_id = gm.grade_id LEFT OUTER JOIN grade_type gt ON gm.grade_type_id = gt.grade_type_id WHERE doc.contractor_user=c_user.id AND
dmd.document_metadata_id = doc.md_id AND dmd.division_id = dim.id AND sgd.last_grade_id is null AND doc.status != 'Forked' AND doc.status in ('Registration Initiated') AND c_user.reservation_category ='NULL'
i did not make any changes to hibernate config files and same code is excuting successfully on other machine. It is returning Object array list, so i did not need to make any changes to bean files.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜