vorburger commented on a change in pull request #925:
URL: https://github.com/apache/fineract/pull/925#discussion_r429383867



##########
File path: 
fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/domain/ProductToGLAccountMappingRepository.java
##########
@@ -30,8 +30,9 @@
     ProductToGLAccountMapping 
findByProductIdAndProductTypeAndFinancialAccountTypeAndPaymentTypeId(Long 
productId, int productType,
             int financialAccountType, Long paymentType);
 
-    ProductToGLAccountMapping 
findByProductIdAndProductTypeAndFinancialAccountTypeAndChargeId(Long productId, 
int productType,
-            int financialAccountType, Long chargeId);
+    @Query("select mapping from ProductToGLAccountMapping mapping where 
mapping.productId= :productId and mapping.productType= :productType and 
mapping.financialAccountType= :financialAccountType and mapping.charge.id= 
:chargeId")
+    ProductToGLAccountMapping 
findProductIdAndProductTypeAndFinancialAccountTypeAndChargeId(@Param("productId")
 Long productId, @Param("productType") int productType,
+            @Param("financialAccountType") int financialAccountType, 
@Param("chargeId") Long ChargeId);

Review comment:
       > So, with findBy query it does not return data , it return null value, 
even data is available, making it more dumb and simple.
    
   I found this puzzling, and had a closer look... and noticed that 
`AndChargeId` is curious - there is no `chargeId` getter and field on 
`ProductToGLAccountMapping` - only a `charge`. Do you want to try to see if 
just renaming the method instead of having to manually specify the query also 
fixes this? If that is so, then I'm interested how to find a way to validate 
those Spring Data Repository interfaces...
   
   >  So, I tested it across steps to reproduce the above now.
   
   do you think you would be able to write an integration test for this problem 
in this PR? Just asking!




----------------------------------------------------------------
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.

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


Reply via email to