2013年7月26日星期五

Strange; hibernate pagination error: could not execute query;

sql:

select b1.batch_id, b1.busi_no, b1.app_code, b1.batch_ver, b1.inter_ver, b1.create_user, b1.create_date, b1.mod_user, b1.mod_date from b_batchs_info b1, b_batchs_src b2 where b1.batch_id = b2.batch_id and b1.batch_ver = b2.batch_ver and b1.inter_ver <> b2.inter_ver and b1.batch_id not in (select batch_id from B_UPDATE_LOCK) union all
select b3.batch_id, b3.busi_no, b3.app_code, b3.batch_ver, b3.inter_ver, b3.create_user, b3.create_date, b3.mod_user, b3.mod_date from b_batchs_info b3 where b3.batch_id not in (select batch_id from b_batchs_src)


sql db2 client runs right

SQLQuery query = session.createSQLQuery (sql.toString ());
query.setFirstResult ((offset - 1) * length);
query.setMaxResults (length);
list = query.list ();

remove this sentence right pagination: query.setMaxResults (length);
plus query.setMaxResults (length); error:
could not execute query .....

Error code: -421 42826 UNION operation selection list does not provide the same number of columns

solved!

------ For reference only ---------------------------------- -----
I was such a problem, depressed
------ For reference only ----------------------- ----------------
look dialect of your database is not set up correctly, my question is this.
------ For reference only -------------------------------------- -
Will this fix the problem? I have encountered, being battered to find solutions to it
------ For reference only --------------------------- ------------
I was wrong dialect, the dialect used mysql, I said how the sql statement how well the output limit, this is not a mysql syntax Mody, later changed orcal10g of, like, engage me several hours Xie 2 #

没有评论:

发表评论