SDN4-找不到带有ID列表的ById [英] SDN4 - Cannot findById with list of id

查看:105
本文介绍了SDN4-找不到带有ID列表的ById的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在旧版本SDN3中,我可以使用findById(List id),但是升级到SDN4之后,我将无法再次使用此功能,总是返回空.

In old version, SDN3, I can use findById(List id), but after upgrade to SDN4, I cannot use this function again, always return empty.

这是我的示例课程:

@NodeEntity
public class Right{

    @GraphId
    Long graphId;

    String id; //random generated UUID

    String name;

    //Properties & Constructor
}

然后我有包含以下代码的RightRepository:

And then I have RightRepository that contain these code :

public interface RightRepository extends GraphRepository<Right> {
    List<Right> findById(List<String> id);
}

代替使用Loop获取每个ID,我只需要调用存储库一次,并获取List(不使用findAll())

Instead of use Loop to get per ID, I need to call repository only once, and get the List (without using findAll())

SDN4是否已不支持它?还有其他解决方案吗?

Is SDN4 already not support it? Is there any other solution?

推荐答案

在我发表评论并进行进一步调查后,我认为自定义查询是目前满足您要求的唯一方法.这有效:

As I post in a comment and after a further investigation, I think that a custom query is the only way to accomplish your requirement at the moment. This works:

@Query("MATCH (n:Right) WHERE n.id IN {rightIds} RETURN n") 
List<Right> findRightById(@Param("rightIds") List<String> rightIds);

希望有帮助

这篇关于SDN4-找不到带有ID列表的ById的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆