-->
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: Transformers.aliasToBean changing int value ???
PostPosted: Wed Nov 01, 2006 9:46 am 
Newbie

Joined: Mon Sep 18, 2006 6:34 am
Posts: 18
Has anybody ever seen a Transformer.aliasToBean change the value of an int field being returned from a session.createSQLQuery call ?

I have the following in a POJO:
List resultList = session.createSQLQuery(
sqlQuery)
.setResultTransformer(
Transformers.aliasToBean(clientDTO.class))
.list();

which maps the results of the sqlQuery string to the clientDTO class.

The sqlQuery text when run on SQL Server returns:

clientId seqNum clientName rankNumber activeInd
4776 0 Acme, Inc. 60150 N

but when the resultList is populated, rankNumber is set to 54. I've tried this with other records and everytime rankNumber is 54. All other field values are correct.

My mapping file is as follows:
<hibernate-mapping>
<class name="clientDTO">
<id name="clientName" type="string" />
<property name="rankNumber" type="long" />
<property name="activeInd" />
</class>
</hibernate-mapping>

and the clientDTO:
/** profilePk. */
private ProfilePk profilePk = new ProfilePk();
/** clientName. */
private String clientName;
/** rankNumber. */
private int rankNumber;
/** activeInd. */
private char activeInd;
/** products. */
private String products;
//getters and setters

profilePk is built from clientId and seqNum in the setter section and products is populated later by another query.

Anyone know why a value like 60150 is being changed to another value within the aliasToBean call even though the mapping xml declares it as a long (also tries integer and big_integer but no joy) and the class variable in the clientDTO is also an int ?


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.