OK, bear in mind that I have never used (and would never use) Spring Data, so I might be misunderstanding something. But it seems that your repository interface is actually WithEmbeddedRepository, and that is the interface which Spring Data fills in the implementation of. In this interface, AnEmbeddable was assigned a concrete type argument, and so when Spring Data fills in the implementation of the generically-typed interface method, it has all the information it needs to pass the correct concrete parameter type to CriteriaBuilder.parameter(). I’m guessing it's passing Object.class because someone is lazy and could not be bothered substituting type arguments for type parameters. Have I got this wrong? |