-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Need help mapping the a SQL-Query DTO class.
PostPosted: Wed Feb 18, 2009 5:39 pm 
Newbie

Joined: Mon Dec 08, 2008 5:51 pm
Posts: 8
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?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.