I have an entity class where I have a value as the salary. Datatype of salary is bigdecimal. Now I want to perform one query on this entity where I have 2 values, fromSalary and toSalary. I want all the employees with salary > fromSalary and salary < toSalary. I am using mongodb as datastore and using mongotemplate criteria query for this operation.
Salary is in Bigdeciaml, fromSalary and toSalary are in Double.
I tried 2 ways.
Criteria.where(Salary).gte(new BigDecimal(fromSalary)).lte(new BigDecimal(toSalary))) ; Criteria.where(Salary).gte(fromSalary).lte(toSalary)) ;
When I perform these operation, I get empty response in both the cases even though I have data in this range in my database.
How to perform range operation on bigdecimal?