Quote:
Is there any way I could use the short entity name as specified in the annotation to get the ClassMetadata?
May be not in a simple way. For some reason (bug?), the FQ name of the class (and not the entity name attribute you specify) is mapped to the corresponding class's ClassMetadata, resulting in the behavior you observe. The name you specify in the annotation is available in a property called nodeName. You can, of course, see the mappings that Hibernate has knowledge of and write a wrapper to get the behavior you desire.
Code:
Configuration cfg = new AnnotationConfiguration()
.addAnnotatedClass(Customer.class)
.configure();
sessionFactory = cfg.buildSessionFactory();
Iterator classes = cfg.getClassMappings();
while(classes.hasNext()){
org.hibernate.mapping.PersistentClass p = (org.hibernate.mapping.PersistentClass) classes.next();
System.out.println("Entity Name: " + p.getEntityName());
System.out.println("Class Name: " + p.getClassName());
System.out.println("Annotated name: " + p.getNodeName());
}