final static String SEPARATOR = "_";
void validate(String name, String method, DaoComponent dao) {
Class<?> current = dao.getEntityClass();
if (name == null) {
throw new MethodExpressionException(null, dao.getDaoClass(), method);
}
for (String property : name.split(SEPARATOR)) {
PropertyQuery<?> query = PropertyQueries.createQuery(current)
.addCriteria(new NamedPropertyCriteria(property));
Property<?> result = query.getFirstResult();
if (result == null) {
throw new MethodExpressionException(property, dao.getDaoClass(), method);
}
current = result.getJavaClass();
}
}