I tried to create native sql query and map to entity class with parameter but fail.
/**
* @return
*/
public List<PoolRuleMapping> getAllPRM() {
Session session = null;
List<PoolRuleMapping> prmList = null;
try {
session = HibernateSessionFactory.getSession();
Query q = session.createSQLQuery("select * from pool_rule_mapping").addEntity(PoolRuleMapping.class);
prmList = q.list();
} catch (HibernateException e) {
} finally {
session.close();
}
return prmList;
}
Please provide an example. Thanks.