ClassMetadata cm = sessionFactory.getClassMetadata(entityName);
org.hibernate.type.ComponentType hcType = (org.hibernate.type.ComponentType) cm
.getPropertyType(propertyName);
String[] propertyNames = hcType.getPropertyNames();
ComponentType cType = new ComponentType(hcType.getReturnedClass());
Map<String, Type> propertyTypes = cType.getPropertyTypes();
for (int j = 0; j < propertyNames.length; j++) {
org.hibernate.type.Type type = cm.getPropertyType(propertyName + "." + propertyNames[j]);
if (type.isEntityType()) {
propertyTypes.put(propertyNames[j], buildEntityType(sessionFactory, type.getName()));
} else if (type.isComponentType()) {