【问题标题】:Is there a @Query for azure cosmosDB? (DocumentDb)azure cosmosDB 有 @Query 吗? (文档数据库)
【发布时间】:2019-11-19 14:25:29
【问题描述】:

就像我们对 sql 驱动程序或 jpa 使用 @Query 一样,在 java 类中使用 azure cosmosDB(DocumentDb) 的替代注释是什么? enter image description here

【问题讨论】:

  • 我附上了 jpa 的示例@Query。
  • 请编辑您的问题以包含实际代码,而不是代码图像。

标签: azure-cosmosdb


【解决方案1】:

当我搜索spring-data-cosmosdb source code 时,它不支持@Query 注释。请参考以下案例:

1.Is there any way to write custom or native queries in Java JPA (DocumentDbRepository) while firing a query to azure-cosmosdb?

2.@Query doesn't work in Spring Boot (JPA ) + Azure Cosmos db

此外,您可以在此feedback 中询问此功能的支持或直接与 azure cosmos db 团队联系。

【讨论】:

  • 谢谢。我没有使用相同的子句来实现功能,而是进行了更长的编码。目前,我能够实现目标。如果我需要更改它,我将按照您在此处发送的链接进行操作。感谢您的建议。
  • @YubrajTamang 不客气,如果您认为答案对您有益,请您接受答案(在答案旁边挂钩),谢谢。
  • 我该怎么做?可以的话可以发一些截图吗?
  • @YubrajTamang 嗨,请在我的答案旁边标记钩子,请参阅此链接:meta.stackexchange.com/questions/5234/...谢谢!
  • 我做到了。那么,有没有办法在 java 类中使用查询?因为,我不想通过 (findAll()) 方法获取数百万个数据。
【解决方案2】:

更新版本

<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-spring-data-cosmos-core</artifactId>
<version>3.0.0-beta.1</version> 
</dependency>

2020 年 8 月发布的版本确实支持 @Query。 您可以通过here 找到文档。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-04-26
    • 2020-07-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多