Does not confirm to expected type (Mutable)Iterable<Int!>


#1

Hi experts,
I am using kotlin with Springboot and while calling a method

repository.findAllById(Should Expect Some Int value)

I am getting error message

The integer literal does not confirm to expected type (Mutable)Iterable<Int!>

looking for help!

Thanks,
Manish


#2

It would appear that the repository method expects not a single ID, but an iterable (list, set, etc) of IDs… Which makes sense for a method named findAllById as the ID is unique.

So either call repository.findById(myUniqueId), to get back the single instance with that ID, or pass all the IDs to the repository interface that you want to retrieve. Like: val entities = repository.findAllById(listOf(1, 2, 3, 4))


#3

yes Tim thanks for the reply.

I was doing spring after a long time, I should be using findById instead.

Someone please close this post.