DaanHoogland commented on pull request #5704:
URL: https://github.com/apache/cloudstack/pull/5704#issuecomment-979065175


   > > @weizhouapache code looks ok, but what is the sense of searching for a 
bunch of fields _and_ the id. The id is unique so this search makes no sense to 
me. Do you know how it is used and why it is a bug there?
   > 
   > @DaanHoogland as I said in description, the issue is with 
findActiveAccountById
   > 
   > 
https://github.com/apache/cloudstack/blob/85373e62191ce18b9d968d366661d3e2efa5909d/engine/schema/src/main/java/com/cloud/user/dao/AccountDaoImpl.java#L199-L203
   > 
   > this method search records by id, but "id" is not supported in 
AllFieldsSearch. therefore the result is same as (id/accountid is ignored)
   > 
   > ```
   >     @Override
   >     public Account findActiveAccountById(Long accountId, Long domainId) {
   >         SearchCriteria<AccountVO> sc = AllFieldsSearch.create();
   >         sc.setParameters("domainId", domainId);
   >         return findOneBy(sc);
   >     }
   > ```
   
   Ah, you are right. I was confusing `SearchBuilder` with `SearchCriteria`.
   Nowhere else in the file the `id` is used in conjunction with the 
`AllFieldsSearch` so I think we are good.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to