@enablescan何时需要DynamoDB存储库中?

发布于 2025-02-05 14:34:15 字数 212 浏览 2 评论 0原文

创建DynamoDB存储库时,默认情况下是否需要ENABLESCAN注释?什么是功能?

@EnableScan
public interface DynamoRepository extends CrudRepository<Data, String> {
    
}

When creating a DynamoDB repository, is the EnableScan annotation required by default? What is it's functionality?

@EnableScan
public interface DynamoRepository extends CrudRepository<Data, String> {
    
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

叶落知秋 2025-02-12 14:34:15

简短的答案是否。仅当您想使用不是分区密钥的属性查询表时,才需要它。

例如:
假设您有一张名为“员工”的桌子,将分区密钥作为员工ID。您还具有诸如FirstName和LastName之类的属性。

在这种情况下,当您使用FindbyId(雇员)时,您不需要@enablescan。但是,当您使用FindbyFirstName(“ John”)时,您需要@enablescan

您可能已经注意到DynamoDB UI中可用的扫描功能。 @enablescan与快照中显示的扫描功能相似。

同样,您不需要@enablescan使用其分区键查询索引时。

The short answer is No. You don't need @EnableScan all the time. You need it only if you want to query the table with an attribute that's not a partition key.

For Example:
Let's say you have a Table called Employee with Partition Key as employee id. You also have attributes like firstName and lastName.

In this case when you use findById(employeeId) you don't need @EnableScan . But when you use findByFirstName("John") then you need @EnableScan

You might have noticed the scan feature that's available in DynamoDB UI. @EnableScan is similar to the scan feature shown in the snapshot.
enter image description here

Likewise, you don't need @EnableScan when you are querying an index with its partition Key.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文