Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 轨道的Grails等价物ARel';包括';_Ruby On Rails_Grails_Gorm_Arel - Fatal编程技术网

Ruby on rails 轨道的Grails等价物ARel';包括';

Ruby on rails 轨道的Grails等价物ARel';包括';,ruby-on-rails,grails,gorm,arel,Ruby On Rails,Grails,Gorm,Arel,我有一个Rails应用程序,我使用ARel“includes”可以显著加快速度,例如(人为设计) 极大地减少了页面负载,并大大减少了查询数量。Rails通过在一个查询中首先选择帖子来实现这一点 select * from posts where ... 然后在一个查询中选择所有这些帖子的所有评论,而不是每个评论一个查询: select * from comments where post_id in (6,7,8,9,10,...) grails中是否有等价物?我熟悉条件和命名查询,在这些条

我有一个Rails应用程序,我使用ARel“includes”可以显著加快速度,例如(人为设计)

极大地减少了页面负载,并大大减少了查询数量。Rails通过在一个查询中首先选择帖子来实现这一点

select * from posts where ...
然后在一个查询中选择所有这些帖子的所有评论,而不是每个评论一个查询:

select * from comments where post_id in (6,7,8,9,10,...)

grails中是否有等价物?我熟悉条件和命名查询,在这些条件和命名查询中,我可以编写一个包含大量联接的查询,但我希望Grails能够生成一些带有“IN”的查询操作员。

我找到了一些关于这个问题的参考资料:并且。

我认为这在某种程度上是可行的,但对于我上面的例子,它会对每个帖子的所有评论进行单独的查询,但我希望对所有帖子的所有评论进行单独的查询。
select * from posts where ...
select * from comments where post_id in (6,7,8,9,10,...)