The "scanPackages" property requires the package name to have a trailing "." which is inconsistent with the component-scan. This feature was adding by SPR-4738
ClassPathScanningCandidateComponentProvider (used by component-scan) constructs the scanning pattern like this:
String packageSearchPath = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX + resolveBasePackage(basePackage) + "/" + this.resourcePattern;
AnnotationSessionFactoryBean constructs the scanning pattern like this:
String pattern = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX + ClassUtils.convertClassNameToResourcePath(pkg) + RESOURCE_PATTERN;
Notice the missing "/" in the hibernate class. This means that the resource pattern is constructed like classpath*:myPackage*/.class instead of classpath*:myPackage/*/.class
This works when all persistence classes are in the package to be scanned, but fails to scan subclasses. AnnotationSessionFactoryBean should be changed to construct its pattern like component-scan does.
A workaround is to append a trailing "." onto the end of your package name.
I meant "fails to scan subpackages", not "fails to scan subclasses"