How can I select subset of attributes from an Nosql database with a condition using spring data repository?How do you query DynamoDB?Structure a dynamoDB table to enable ASC or DESC ordered pagination on * items in a tableHow to structure a DynamoDB database to allow queries for trending posts?DynamoDB API: How can I build an “add JSON attribute if not present” update request?DynamoDB query on boolean keyQuestions around Primary Key and Sort Keys in DynamoDBList comprehensions in FilterExpression in boto3 for DynamodbHow to select from multiple tables based on conditionHow to query items from DynamoDB that only have unique attribute values?How to handle many to many in DynamoDB

Cisco 3750X Power Cable

Gravitational Force Between Numbers

Are cells guaranteed to get at least one mitochondrion when they divide?

Is a world with one country feeding everyone possible?

Split into three!

Visual Block Mode edit with sequential number

Why was this character made Grand Maester?

Why do the i8080 I/O instructions take a byte-sized operand to determine the port?

How to deceive the MC

Is superuser the same as root?

Why A=2 and B=1 in the call signs for Spirit and Opportunity?

Flatten not working

Why is unzipped directory exactly 4.0K (much smaller than zipped file)?

Can a UK national work as a paid shop assistant in the USA?

Are runways booked by airlines to land their planes?

Ribbon Cable Cross Talk - Is there a fix after the fact?

What is Orcus doing with Mind Flayers in the art on the last page of Volo's Guide to Monsters?

Team has team lunch everyday, am I forced to go?

Status of proof by contradiction and excluded middle throughout the history of mathematics?

Time complexity of an algorithm: Is it important to state the base of the logarithm?

Why did other houses not demand this?

Can I render satellite deployment impossible, or at least impractical, by exploiting the Kessler syndrome?

Possibility of faking someone's public key

How does Dreadhorde Arcanist interact with split cards?



How can I select subset of attributes from an Nosql database with a condition using spring data repository?


How do you query DynamoDB?Structure a dynamoDB table to enable ASC or DESC ordered pagination on * items in a tableHow to structure a DynamoDB database to allow queries for trending posts?DynamoDB API: How can I build an “add JSON attribute if not present” update request?DynamoDB query on boolean keyQuestions around Primary Key and Sort Keys in DynamoDBList comprehensions in FilterExpression in boto3 for DynamodbHow to select from multiple tables based on conditionHow to query items from DynamoDB that only have unique attribute values?How to handle many to many in DynamoDB






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















In a NoSQL DB(DynamoDB), the table has 10 attributes. I only need to get 3 attributes from it. Two of them are the composite primary key(id, name), the rest one is isCreated. If I want to select all the items which isCreated is true, how can I define the name of the method in the repository of spring data? which annotation should I use?
In the relational database, the SQL would be like this:
"select id, name from table_name where isCreated=true".
1. In this way, I can get two attributes,but it can't get rid of the items whose isCreated is false.



@Query(string = "id, name")
public findByIdAndName(String id, String name);


2. This way will throw an exception. it said, "can't scan table or using @EnableScan to enable it".



@Query(string = "id, name")
public findByIdAndNameAndIsCreated(String id, String name, boolean isCreated);



  1. This way can get rid of the items whose isCreated is false. but it selected all the ten attributes. But I only need two.



    @Query(string = "id, name")
    @EnableScan
    public findByIdAndNameAndIsCreated(String id, String name, boolean isCreated);



What is the correct answer?










share|improve this question






















  • I think projections can help you docs.spring.io/spring-data/jpa/docs/current/reference/html/…

    – seti
    Mar 24 at 2:19











  • Thanks, Seti. That's really helpful.

    – George
    Mar 25 at 6:57











  • finally, I use Dynamodb API called query() + Dynamodb projections API solved the problem. This is the easiest way for it. Thanks.

    – George
    Apr 9 at 6:19

















0















In a NoSQL DB(DynamoDB), the table has 10 attributes. I only need to get 3 attributes from it. Two of them are the composite primary key(id, name), the rest one is isCreated. If I want to select all the items which isCreated is true, how can I define the name of the method in the repository of spring data? which annotation should I use?
In the relational database, the SQL would be like this:
"select id, name from table_name where isCreated=true".
1. In this way, I can get two attributes,but it can't get rid of the items whose isCreated is false.



@Query(string = "id, name")
public findByIdAndName(String id, String name);


2. This way will throw an exception. it said, "can't scan table or using @EnableScan to enable it".



@Query(string = "id, name")
public findByIdAndNameAndIsCreated(String id, String name, boolean isCreated);



  1. This way can get rid of the items whose isCreated is false. but it selected all the ten attributes. But I only need two.



    @Query(string = "id, name")
    @EnableScan
    public findByIdAndNameAndIsCreated(String id, String name, boolean isCreated);



What is the correct answer?










share|improve this question






















  • I think projections can help you docs.spring.io/spring-data/jpa/docs/current/reference/html/…

    – seti
    Mar 24 at 2:19











  • Thanks, Seti. That's really helpful.

    – George
    Mar 25 at 6:57











  • finally, I use Dynamodb API called query() + Dynamodb projections API solved the problem. This is the easiest way for it. Thanks.

    – George
    Apr 9 at 6:19













0












0








0








In a NoSQL DB(DynamoDB), the table has 10 attributes. I only need to get 3 attributes from it. Two of them are the composite primary key(id, name), the rest one is isCreated. If I want to select all the items which isCreated is true, how can I define the name of the method in the repository of spring data? which annotation should I use?
In the relational database, the SQL would be like this:
"select id, name from table_name where isCreated=true".
1. In this way, I can get two attributes,but it can't get rid of the items whose isCreated is false.



@Query(string = "id, name")
public findByIdAndName(String id, String name);


2. This way will throw an exception. it said, "can't scan table or using @EnableScan to enable it".



@Query(string = "id, name")
public findByIdAndNameAndIsCreated(String id, String name, boolean isCreated);



  1. This way can get rid of the items whose isCreated is false. but it selected all the ten attributes. But I only need two.



    @Query(string = "id, name")
    @EnableScan
    public findByIdAndNameAndIsCreated(String id, String name, boolean isCreated);



What is the correct answer?










share|improve this question














In a NoSQL DB(DynamoDB), the table has 10 attributes. I only need to get 3 attributes from it. Two of them are the composite primary key(id, name), the rest one is isCreated. If I want to select all the items which isCreated is true, how can I define the name of the method in the repository of spring data? which annotation should I use?
In the relational database, the SQL would be like this:
"select id, name from table_name where isCreated=true".
1. In this way, I can get two attributes,but it can't get rid of the items whose isCreated is false.



@Query(string = "id, name")
public findByIdAndName(String id, String name);


2. This way will throw an exception. it said, "can't scan table or using @EnableScan to enable it".



@Query(string = "id, name")
public findByIdAndNameAndIsCreated(String id, String name, boolean isCreated);



  1. This way can get rid of the items whose isCreated is false. but it selected all the ten attributes. But I only need two.



    @Query(string = "id, name")
    @EnableScan
    public findByIdAndNameAndIsCreated(String id, String name, boolean isCreated);



What is the correct answer?







java spring attributes nosql repository






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 23 at 21:57









GeorgeGeorge

11




11












  • I think projections can help you docs.spring.io/spring-data/jpa/docs/current/reference/html/…

    – seti
    Mar 24 at 2:19











  • Thanks, Seti. That's really helpful.

    – George
    Mar 25 at 6:57











  • finally, I use Dynamodb API called query() + Dynamodb projections API solved the problem. This is the easiest way for it. Thanks.

    – George
    Apr 9 at 6:19

















  • I think projections can help you docs.spring.io/spring-data/jpa/docs/current/reference/html/…

    – seti
    Mar 24 at 2:19











  • Thanks, Seti. That's really helpful.

    – George
    Mar 25 at 6:57











  • finally, I use Dynamodb API called query() + Dynamodb projections API solved the problem. This is the easiest way for it. Thanks.

    – George
    Apr 9 at 6:19
















I think projections can help you docs.spring.io/spring-data/jpa/docs/current/reference/html/…

– seti
Mar 24 at 2:19





I think projections can help you docs.spring.io/spring-data/jpa/docs/current/reference/html/…

– seti
Mar 24 at 2:19













Thanks, Seti. That's really helpful.

– George
Mar 25 at 6:57





Thanks, Seti. That's really helpful.

– George
Mar 25 at 6:57













finally, I use Dynamodb API called query() + Dynamodb projections API solved the problem. This is the easiest way for it. Thanks.

– George
Apr 9 at 6:19





finally, I use Dynamodb API called query() + Dynamodb projections API solved the problem. This is the easiest way for it. Thanks.

– George
Apr 9 at 6:19












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55318778%2fhow-can-i-select-subset-of-attributes-from-an-nosql-database-with-a-condition-us%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55318778%2fhow-can-i-select-subset-of-attributes-from-an-nosql-database-with-a-condition-us%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript