<bdo id='pgwlQ'></bdo><ul id='pgwlQ'></ul>

        <small id='pgwlQ'></small><noframes id='pgwlQ'>

        <i id='pgwlQ'><tr id='pgwlQ'><dt id='pgwlQ'><q id='pgwlQ'><span id='pgwlQ'><b id='pgwlQ'><form id='pgwlQ'><ins id='pgwlQ'></ins><ul id='pgwlQ'></ul><sub id='pgwlQ'></sub></form><legend id='pgwlQ'></legend><bdo id='pgwlQ'><pre id='pgwlQ'><center id='pgwlQ'></center></pre></bdo></b><th id='pgwlQ'></th></span></q></dt></tr></i><div id='pgwlQ'><tfoot id='pgwlQ'></tfoot><dl id='pgwlQ'><fieldset id='pgwlQ'></fieldset></dl></div>

        <tfoot id='pgwlQ'></tfoot>

        <legend id='pgwlQ'><style id='pgwlQ'><dir id='pgwlQ'><q id='pgwlQ'></q></dir></style></legend>
      1. 在 Java 中使用 DynamoDBMapper 更新 DynamoDB 项目

        Update DynamoDB item using DynamoDBMapper in Java(在 Java 中使用 DynamoDBMapper 更新 DynamoDB 项目)

                <tbody id='kNLBZ'></tbody>
            1. <small id='kNLBZ'></small><noframes id='kNLBZ'>

              1. <legend id='kNLBZ'><style id='kNLBZ'><dir id='kNLBZ'><q id='kNLBZ'></q></dir></style></legend>
                • <bdo id='kNLBZ'></bdo><ul id='kNLBZ'></ul>
                  <i id='kNLBZ'><tr id='kNLBZ'><dt id='kNLBZ'><q id='kNLBZ'><span id='kNLBZ'><b id='kNLBZ'><form id='kNLBZ'><ins id='kNLBZ'></ins><ul id='kNLBZ'></ul><sub id='kNLBZ'></sub></form><legend id='kNLBZ'></legend><bdo id='kNLBZ'><pre id='kNLBZ'><center id='kNLBZ'></center></pre></bdo></b><th id='kNLBZ'></th></span></q></dt></tr></i><div id='kNLBZ'><tfoot id='kNLBZ'></tfoot><dl id='kNLBZ'><fieldset id='kNLBZ'></fieldset></dl></div>

                  <tfoot id='kNLBZ'></tfoot>
                  本文介绍了在 Java 中使用 DynamoDBMapper 更新 DynamoDB 项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  如何使用 DynamoDBMapper 更新 DynamoDB 项目?

                  How can I update DynamoDB item using DynamoDBMapper?

                  我有多个进程,使用 DynamoDB 表,因此,get + save 会造成不一致.我找不到使用 DynamoDBMapper 更新项目的方法.

                  I have multiple processes, using the DynamoDB table, thus, get + save will create inconsistency. I can not find the method to update the item using DynamoDBMapper.

                  推荐答案

                  save()方法会执行putItemupdateItem 基于 SaveBehavior 中设置的值.请参考以下说明.由于这个原因,DynamoDBMapper 类中没有更新方法.但是,有一个单独的删除方法可用.

                  The save() method will perform the putItem or updateItem based on the value set in SaveBehavior. Please refer the below description. There is no update method in DynamoDBMapper class because of this reason. However, there is a separate delete method available.

                  在 DynamoDB 中保存项目.使用的服务方法由DynamoDBMapperConfig.getSaveBehavior() 值,使用任一AmazonDynamoDB.putItem(PutItemRequest) 或AmazonDynamoDB.updateItem(UpdateItemRequest):

                  Saves an item in DynamoDB. The service method used is determined by the DynamoDBMapperConfig.getSaveBehavior() value, to use either AmazonDynamoDB.putItem(PutItemRequest) or AmazonDynamoDB.updateItem(UpdateItemRequest):

                  更新(默认):UPDATE 不会影响保存操作和建模属性的 null 值会将其从该项目中删除动态数据库.由于 updateItem 请求的限制,当只有键时,UPDATE 的实现将发送 putItem 请求对象正在被保存,如果它会发送另一个 updateItem 请求给定的键已经存在于表中.

                  UPDATE (default) : UPDATE will not affect unmodeled attributes on a save operation and a null value for the modeled attribute will remove it from that item in DynamoDB. Because of the limitation of updateItem request, the implementation of UPDATE will send a putItem request when a key-only object is being saved, and it will send another updateItem request if the given key(s) already exists in the table.

                  UPDATE_SKIP_NULL_ATTRIBUTES : 与 UPDATE 类似,只是它忽略任何空值属性,并且不会将它们从该项目中删除动态数据库.它还保证只发送一个 updateItem请求,无论对象是否仅键.

                  UPDATE_SKIP_NULL_ATTRIBUTES : Similar to UPDATE except that it ignores any null value attribute(s) and will NOT remove them from that item in DynamoDB. It also guarantees to send only one single updateItem request, no matter the object is key-only or not.

                  CLOBBER: CLOBBER将清除并替换所有属性,包括未建模的属性,(删除并重新创建)保存.版本化的字段约束也将被忽视.saveExpression 参数中指定的任何选项由于版本化属性,将覆盖在任何约束上.

                  CLOBBER : CLOBBER will clear and replace all attributes, included unmodeled ones, (delete and recreate) on save. Versioned field constraints will also be disregarded. Any options specified in the saveExpression parameter will be overlaid on any constraints due to versioned attributes.

                  用法示例:-

                  DynamoDBMapperConfig dynamoDBMapperConfig = new DynamoDBMapperConfig(SaveBehavior.UPDATE);
                  

                  更新 DynamoDBMapperConfig (aws sdk 1.11.473) 构造函数似乎已被弃用,应该改用构建器:

                  UPDATE DynamoDBMapperConfig (aws sdk 1.11.473) constructor seems to be deprecated and the builder should be used instead:

                  DynamoDBMapperConfig dynamoDBMapperConfig = new DynamoDBMapperConfig.Builder()
                    .withConsistentReads(DynamoDBMapperConfig.ConsistentReads.CONSISTENT)
                    .withSaveBehavior(DynamoDBMapperConfig.SaveBehavior.UPDATE)
                    .build();
                  dynamoDBMapper.save(yourObject, dynamoDBMapperConfig);
                  

                  这篇关于在 Java 中使用 DynamoDBMapper 更新 DynamoDB 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Lucene Porter Stemmer not public(Lucene Porter Stemmer 未公开)
                  How to index pdf, ppt, xl files in lucene (java based or python or php any of these is fine)?(如何在 lucene 中索引 pdf、ppt、xl 文件(基于 java 或 python 或 php 中的任何一个都可以)?)
                  KeywordAnalyzer and LowerCaseFilter/LowerCaseTokenizer(KeywordAnalyzer 和 LowerCaseFilter/LowerCaseTokenizer)
                  How to search between dates (Hibernate Search)?(如何在日期之间搜索(休眠搜索)?)
                  How to get positions from a document term vector in Lucene?(如何从 Lucene 中的文档术语向量中获取位置?)
                  Java Lucene 4.5 how to search by case insensitive(Java Lucene 4.5如何按不区分大小写进行搜索)
                • <small id='K7fC1'></small><noframes id='K7fC1'>

                      <i id='K7fC1'><tr id='K7fC1'><dt id='K7fC1'><q id='K7fC1'><span id='K7fC1'><b id='K7fC1'><form id='K7fC1'><ins id='K7fC1'></ins><ul id='K7fC1'></ul><sub id='K7fC1'></sub></form><legend id='K7fC1'></legend><bdo id='K7fC1'><pre id='K7fC1'><center id='K7fC1'></center></pre></bdo></b><th id='K7fC1'></th></span></q></dt></tr></i><div id='K7fC1'><tfoot id='K7fC1'></tfoot><dl id='K7fC1'><fieldset id='K7fC1'></fieldset></dl></div>
                        <legend id='K7fC1'><style id='K7fC1'><dir id='K7fC1'><q id='K7fC1'></q></dir></style></legend>
                          <tbody id='K7fC1'></tbody>
                          <tfoot id='K7fC1'></tfoot>
                            <bdo id='K7fC1'></bdo><ul id='K7fC1'></ul>