@RemoteMethod
@SuppressWarnings("unchecked")
public List<ValuePair<String, String>> fetchReferences(Class<?> clazz, String path, String query, int count, int number) throws Exception {
Assert.isEncrypted(decipherer, path);
DomainEntity parent = (DomainEntity) ClassUtils.instantiateClass(clazz);
Selectable entity = (Selectable) ClassUtils.instantiateClass(new BeanWrapperImpl(parent).getPropertyType(decipherer.decrypt(path)));
if (entity == null) entity = (Selectable) parent;
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("query", query + "%");
List<ValuePair<String, String>> result = new ArrayList<ValuePair<String, String>>(number);
for (Object[] o : dao.executeQuery(entity.selectableQuery(), count, number, parameters))