HQL limit in subselect query

一笑奈何 提交于 2019-12-10 21:47:20

问题


I want to insert foreign key of one table in another on basis of certain criteria. Structure is like

insert into CustomerResult(customer,draw) select c.idCustomer, from Customer c,Draw d where ..... and  c.idCustomer in (select cc.idCustomer from Customer cc where ..... limit 10)

here i want to insert only fix no of records which fulfill certain criteria. I know hql has no limit keyword but want to implement like this. any suggestion?


回答1:


I don't think that what you want to do (use limit in subquery) is directly supported by Hibernate. Have a look at these previous answers:

  • How to set a limit to inner query in Hibernate?
  • How do you do a limit query in HQL?


来源:https://stackoverflow.com/questions/8784354/hql-limit-in-subselect-query

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!