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

    <small id='8IeTp'></small><noframes id='8IeTp'>

    • <bdo id='8IeTp'></bdo><ul id='8IeTp'></ul>

    1. <legend id='8IeTp'><style id='8IeTp'><dir id='8IeTp'><q id='8IeTp'></q></dir></style></legend>

      用于条件保存的 DynamoDBMapper

      DynamoDBMapper for conditional saves(用于条件保存的 DynamoDBMapper)
    2. <legend id='qxD5Z'><style id='qxD5Z'><dir id='qxD5Z'><q id='qxD5Z'></q></dir></style></legend>

              <tfoot id='qxD5Z'></tfoot>

              • <bdo id='qxD5Z'></bdo><ul id='qxD5Z'></ul>

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

                  <tbody id='qxD5Z'></tbody>

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

                本文介绍了用于条件保存的 DynamoDBMapper的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在使用 DynamoDBMapper,并且希望有条件地保存当且仅当 hashkey 和 range 键组合不存在时.我知道有一些方法可以使用 UUID 来减少发生冲突的可能性,但我想通过使用条件保存来保护自己.

                I'm using DynamoDBMapper and would like to conditionally save if and only if the hashkey and range key combination does not exist. I know there are ways to use UUIDs to reduce the possibility of a collision but I would like to protect myself by using conditional saves.

                我遇到了这篇文章 使用 DynamoDBSaveExpression 但是我无法指定条件是hashkey AND rangekey"不能存在.API 指定withConditionalOperator 方法,但我在课堂上看不到这个.我也在使用来自 here 的最新 aws java sdk.

                I came across this article that uses DynamoDBSaveExpression however I'm not able to specify that the condition is "hashkey AND rangekey" cannot exist. The API specifies a withConditionalOperator method but I'm not able to see this in my class. I am using the latest aws java sdk also from here.

                关于如何有条件地保存的任何建议?或者我可能做错了什么?

                Any suggestions on how to conditionally save? Or what I may be doing incorrectly?

                推荐答案

                DynamoDBSaveExpression saveExpression = new DynamoDBSaveExpression();
                Map<String, ExpectedAttributeValue> expectedAttributes = 
                    ImmutableMap.<String, ExpectedAttributeValue>builder()
                        .put("hashKey", new ExpectedAttributeValue(false))
                        .put("rangeKey", new ExpectedAttributeValue(false))
                        .build();
                saveExpression.setExpected(expectedAttributes);
                saveExpression.setConditionalOperator(ConditionalOperator.AND);
                try {
                    dynamoDBMapper.save(objectToSave, saveExpression);
                } catch (ConditionalCheckFailedException e) {
                    //Handle conditional check
                }
                

                这使用 public ExpectedAttributeValue(Boolean exists) 构造函数,它只是在内部调用 setExists.

                This uses the public ExpectedAttributeValue(Boolean exists) constructor, which just internally calls setExists.

                这篇关于用于条件保存的 DynamoDBMapper的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                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如何按不区分大小写进行搜索)

                • <bdo id='pUhMi'></bdo><ul id='pUhMi'></ul>
                • <legend id='pUhMi'><style id='pUhMi'><dir id='pUhMi'><q id='pUhMi'></q></dir></style></legend>

                          <tbody id='pUhMi'></tbody>

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

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

                          <tfoot id='pUhMi'></tfoot>