on 2018 Apr 05 2:54 PM
Hi All,
We are getting multiple records as part of third-party SOAP API response, so I have to verify whether records exist in the database because invoking saveall() is throwing an exception if any record already exists in the database. So there should be two separate actions, one to insert the new record and second one to update existing records using current primary key against the record. Before splitting the records in the response into new and old records sets, I have check these records exist in the database or not. In this scenario, how do I verifying multiple records exist or not in the Database in a single hit than hitting databased for each record i.e. multiple times.
I really appreciate your help and support in advance
Request clarification before answering.
Thanks Guys, I think getModelsByExample will help me to solve the senario.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rahul, thanks for your feedback, can I use this method to check multiple records in one hit or one by one?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sreejith , you can use flexibleSearchService.getModelsByExample(...) to check for multiple models. You can also refer link for the example for the same .
https://help.hybris.com/6.6.0/hcd/8c146aa686691014bbf6fe76a708ece2.html
Hi Sreejith,
I think you have to use the primary key of the item type like code to find whether data already exists for the item instance you are updating. Use flexible search query for the same.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.