I am successfully using Hibernate to call a stored procedure defined in ta config file as follows:
<sql-query name="GetScore" callable="true">
{ call DETAILS_PKG.Score ?, :key, :date ) }
</sql-query>
The java sniplet:
hibernateSession = HibernateUtil.openSession();
Query q = hibernateSession.getNamedQuery("GetScore");
q.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);
q.setReadOnly(true);
Object res = q.uniqueResult();
Yields the stored procedure result set as a map, the map keys are B1, B2, B3, ...;
Next I want to replace the map with a non-table POJO and use the Transformers.aliasToBean(DTO.class), however when I try to update the config file, I cannot get hibernate to recognize the DTO.
Do I need to seperately add this to the configuration elsewhere.
<sql-query name="GetScore" callable="true">
<return class="ScoreDTO">
<return-property name="score" column="B7">
<return-column name="B7"/></return-property>
</return>
{ call DETAILS_PKG.Score ?, :key, :date ) }
</sql-query>
furthermore, where does the B1,B2, etc names come from.
how can I change those to something more meaningful?
|