As a side note, I'm currently circumventing this problem by subclassing LocalSessionFactoryBean to add a "mappingClasses" property that delegates to the "mappingResources" property:
Code:
public class ClassAwareLocalSessionFactoryBean extends LocalSessionFactoryBean
{
public void setMappingClasses(Class[] mappingClasses)
{
String[] mappingResources = new String[mappingClasses.length];
for (int i = 0; i < mappingClasses.length; i++)
mappingResources[i] = mappingClasses[i].getName().replace('.', '/') + ".hbm.xml";
setMappingResources(mappingResources);
}
}
This works, but it would be nicer if instead of manually translating the class name to a mapping file, LocalSessionFactoryBean actually acknowledged a collection of classes to pass to Config.addClass(), and let Hibernate figure out the resource locations.