I currently have the following named query that wraps around a stored procedure:-
Based on @partenon's answer on using a custom ResultTransformer, here's the final solution:-
MyBean myBean = (MyBean) sessionFactory.getCurrentSession()
.getNamedQuery("mySp")
.setParameter("param", param)
.setResultTransformer(new BasicTransformerAdapter() {
private static final long serialVersionUID = 1L;
@Override
public Object transformTuple(Object[] tuple, String[] aliases) {
String firstName = (String) tuple[0];
String lastName = (String) tuple[1];
return new MyBean(firstName, lastName);
}
})
.uniqueResult();