要转换的SQL语句
select * from tableA where columnA is not null
order by cast(columnA as int), columnB
union all
select * from app_data_program where columnA is null order by columnB
我的HQL尝试:
From TableA a where a.columnA is not null
order by cast(a.columnA as int), a.columnB
union all TableA b where b.columnA is not null order by b.columnB
当我将HQL转换为SQL以进行测试时,我得到以下结果:
SQL Error: Missing IN or OUT parameter at index:: 1
答案 0 :(得分:0)
HQL不允许使用UNION ALL sql构造。
您必须执行两个不同的查询,然后才能合并它们的结果。
所以你会:
首先查询:
From TableA a where a.columnA is not null
order by cast(a.columnA as int), a.columnB
第二次查询:
TableA b where b.columnA is not null order by b.columnB