HQL - row identifier for pagination

前端 未结 3 1744
慢半拍i
慢半拍i 2020-12-01 08:51

Does anyone know if HQL has a keyword to identify rows such as ROWID or ROWNUM?

I would like to implement pagination with HQL but I am not able to use .setMaxResult(

3条回答
  •  伪装坚强ぢ
    2020-12-01 09:23

    Well, you can in principle access ROWNUM/ROWID from HSQL (though I've never used it). See e.g. Ron's Weblog. That should work.

    But I'd like to point out that you're really working against Hibernate and HSQL if you do it like that. The proper way is to use setMaxResult() & friends. If you cannot do that b/c of your architecture, I'd at least reconsider my architectural decisions. I know these are always tough changes to make, but it might be worth it.

提交回复
热议问题