As you mentionned in your comment, "allocateByList" has, for example, the value "'M06','M81'".
So you are doing the following request:
select *
from A a
join B b ON a.allocateBy = b.empNo
join D d ON b.departmentName = d.departmentName
where a.allocateBy in ('''M06'',''M81''')
You are looking for a value "a" having an "allocateBy" value at " 'M06','M81' ".
I believe you want one which have either the value "M06" or the value "M81".
So you have to do the following modifications:
1) Modify the type of allocateByList
from String
to List<String>
2) Format the searched value correctly: you have to split on ,
and then remove the '
wrapping your values.
So:
String allocateByListInitial = "'M06','M81'";
String[] allocateByListSplitted = allocateByListInitial.split(",");
// allocateByListSplitted = ["'M06'", "'M81'"] (with single quote wrapping each value)
List<String> allocateByList = Arrays.stream(allocateByListSplitted)
.map(str -> str.substring(1, str.length() - 1)) // Remove first and last character of the string
.collect(Collectors.toList());
// allocateByList = ["M06", "M81"] (without the single quote)
List<PointAllocation> pointAllocations = myRepo.findAllByAllocateByIn(allocateByList);