private Object[] getObjects(Class fromDataClass, int id, String propertyName, Class toDataClass) throws Exception {
try {
Session session = ThreadSession.get();
Class objectClass = getInternalClass(fromDataClass);
log.debug("getting object: " + id);
Object object = session.load(objectClass, new Integer(id));
log.debug("loaded object: " + object);
Collection objects = (Collection)PropertyUtils.getProperty(object, propertyName);
Object[] dataArray = toArray(toDataClass, objects);
return dataArray;
} catch (Exception ex) {