-->
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.  [ 2 posts ] 
Author Message
 Post subject: Issue with ResultTransformer
PostPosted: Mon Jun 01, 2009 11:22 am 
Newbie

Joined: Mon Jun 01, 2009 11:03 am
Posts: 3
Hi,

Will really appreciate any help on this.

I am having an issue with ResultTransformer, I am using a store procedure to get data from MySQL DB.

If I create a signature in hbm.xml

CASE 1:

<sql-query name="testFact" callable="true">
<return alias="ArrayData" class="com.emc.ecc.datasource.spm.datamanager.dmfdata.DMFArrayInterval"/>
{call spa_GetFactData(:unit,:categoryType,:aggType,:tableName,:id,:logicalIDs,:startKey,:endKey,:sortKey,:startRow,:numOfRow)}
</sql-query>

and in code if I try

Query snapshotQuery = session.getNamedQuery("testFact");

snapshotQuery
.setParameter("unit", aggTypeString)
.setParameter("categoryType", category.prettyName())
.setParameter("aggType", aggTypeFunc)
.setParameter("tableName", tableName)
.setParameter("id", id)
.setParameter("logicalIDs", idsString)
.setParameter("startKey", DMFTimeDimension.getRightStartKey(startDate, aggregateType))
.setParameter("endKey", DMFTimeDimension.getRightEndKey(endDate, aggregateType))
.setParameter("sortKey", null)
.setParameter("startRow", null)
.setParameter("numOfRow", null);


That work's fine. But when I try to do

CASE 2:

Query snapshotQuery = session.createSQLQuery("call spa_GetFactData(:unit,:categoryType,:aggType,:tableName,:id,:logicalIDs,:startKey,:endKey,:sortKey,:startRow,:numOfRow)");

snapshotQuery
.setParameter("unit", aggTypeString)
.setParameter("categoryType", category.prettyName())
.setParameter("aggType", aggTypeFunc)
.setParameter("tableName", tableName)
.setParameter("id", id)
.setParameter("logicalIDs", idsString)
.setParameter("startKey", DMFTimeDimension.getRightStartKey(startDate, aggregateType))
.setParameter("endKey", DMFTimeDimension.getRightEndKey(endDate, aggregateType))
.setParameter("sortKey", null)
.setParameter("startRow", null)
.setParameter("numOfRow", null);
.setResultTransformer(Transformers.aliasToBean(dbClass.factClassName));


ResultTransformer throws an error that property is not mapped (I make sure return class is same in both cases).

The difference I see SQLQueryImpl objects build differently in Case 1 "queryReturns" parameters are set but in case of ResultTransformer it's not.

The reason I don't want to use Case 1 because my Return class is different based on the input parameters and I have to repeat same store procedure with different return class. Where as in case 2 I can do that dynamically.

Is there any way I can set "queryReturns" parameter in case 2.

Thanks,


Top
 Profile  
 
 Post subject: Re: Issue with ResultTransformer
PostPosted: Mon Jun 01, 2009 1:04 pm 
Newbie

Joined: Mon Jun 01, 2009 11:03 am
Posts: 3
Please ignore my previous post, I figure out how to do this. Thanks.


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

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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.