Map<String, Object> options = filter.getOptions();
Query q = null;
if (filter.getType() == ORMFilterType.NAMED) {
throw new PersistenceException("Hibernate dont support named queries");
} else if (filter.getType() == ORMFilterType.NATIVE) {
if ((Conditions.isContainingKey(options, ORMOptions.OPTION_TARGET_ENTITY))) {
Object targetEntity = options.get(ORMOptions.OPTION_TARGET_ENTITY);
if (targetEntity instanceof Class) {
SQLQuery sq = session.createSQLQuery(filter.getFilter());
sq.addEntity((Class) targetEntity);
q = sq;
} else if (targetEntity instanceof String) {
try {
SQLQuery sq = session.createSQLQuery(filter.getFilter());
sq.addEntity(Class.forName((String) targetEntity));
q = sq;
} catch (ClassNotFoundException e) {
throw new PersistenceException(e);
}
} else {
throw new PersistenceException("Invalid option[" + ORMOptions.OPTION_TARGET_ENTITY + "] " + targetEntity);
}
} else {
q = session.createSQLQuery(filter.getFilter());
}
} else {