findById - Can we have the option to filter on "_class" for findById(ID id) implicitly

I have the same problem. @davidkelly Both class A and B have their own repositories i.e. aRepo and bRepo. If I do a aRepo.findById(bId) it will map the B class instead of giving me and empty optional result.

@hari added my own findById function that filters on the class:

@Query("#{#n1ql.selectEntity} WHERE META(#{#n1ql.bucket}).id = $1 AND #{#n1ql.filter}")
Optional<A> findByIdFilter(String id);

I do not want to override the findById() function as that still has purpose. With the findByIdFilter I need an index on _class and id.

Would be helpful we can specify that as some sort of annotation.