How do I use @IdClass with JPA Repository?
问题 I've been using a Spring JPA Repository interface to persist objects, and it works great! But how do I use it when the @Entity defines an @IdClass ? The class is not embedded, but the fields are part of the object. Is it expected I should create findBy methods that name all the composite fields? Or is there a way to create a findById and pass the PK class? 回答1: Nevermind - I found what I was missing. I was extending org.springframework.data.repository.Repository when what I really wanted was