ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jerry Jalenak <jerry.jale...@gmail.com>
Subject Re: queryForObject with Preallocated Object
Date Tue, 21 Dec 2004 14:19:10 GMT
In the iBatis Developer Guide, page 43, there is a usage example that
does not show the sqlMap.queryForObject needing a return value.  I
have also tried your suggestion this morning, and end up with my 'ui'
object set to null - not filled in the way I would expect it to be....

Jerry


On Tue, 21 Dec 2004 13:42:44 +0100, Mikael Berglund
<mikael.berglund@educ.umu.se> wrote:
> Jerry Jalenak wrote:
> 
> > public void getUserByName(UserInfo ui)
> >    throws SQLException
> > {
> >     SqlMapClient sqlMap = getSqlMapClient();
> >     sqlMap.queryForObject("getUserInfo", ui.getUserName(), ui);
> > }
> >
> > </snip>
> >
> > The statement gets executed correctly, but the 'ui' object is not
> > getting filled with the result set.  Can any one point out what it is
> > I'm doing wrong?
> 
> Hello,
> 
> you have to assign the object returned by queryForObject()
> to your variable.
> 
>    ui = (UserInfo) sqlMap.queryForObject("getUserInfo",
> ui.getUserName(), ui);
> 
> Regards,
> Mikael
> 
>

Mime
View raw message