I also tried both case where primary key class is in the same package and in different package. In both cases I get only className.class
​Nothing about the package where it comes from.

Also how to check that it implements serializable?

This is a requirement of the Spring repository interfaces.