ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From top de castro <rocieldecas...@yahoo.com>
Subject RE: nullValue for Boolean wrapper class property
Date Thu, 10 Jan 2008 21:27:33 GMT
Niels,

The above-captioned issue has been fixed.

I added the following code to the getResult method of
my TypeHandlerCallback class:

public Object getResult(ResultGetter getter) throws
SQLException {
		String s = getter.getString();
		
		if (s == null) {
			return new Boolean(false);
		} 

--- Niels Beekman <n.beekman@wis.nl> wrote:

> Sorry, missed this reply. The SQL looks fine, try to
> reproduce the error
> with a minimalistic query, remove the includes and
> parameters and try it
> again. You could also try to reproduce it using
> plain JDBC.
> 
> Niels
> 
> -----Original Message-----
> From: top de castro
> [mailto:rocieldecastro@yahoo.com] 
> Sent: Thursday, January 10, 2008 6:22 PM
> To: user-java@ibatis.apache.org
> Subject: RE: nullValue for Boolean wrapper class
> property
> 
> Here is the information on the select statement,
> less
> the sqlFragments which contain the column names.
> 
> <select id="selectMemberWithDependentsById"
> parameterClass="java.util.HashMap" 
> resultMap="memberWithDependents">
> 	select
> 	<include refid="SqlFragment.memberFieldFragment"/>,
> 	<include
> refid="SqlFragment.dependentFieldFragment"/>
> 	from member, depend
> 	where mb_key = #memberId#
> 	and mb_key = dp_mb_key
> </select>
> 
> 
> --- top de castro <rocieldecastro@yahoo.com> wrote:
> 
> > Niels,
> > 
> > Thanks for the response.  
> > 
> > This exception is from the select query.  Here is
> > the
> > method:
> > 
> > 	public ArrayList
> > selectMemberWithDependentsById(String memberId)
> > throws
> > DatabaseException {
> > 		
> > 		logger.debug("START -
> > selectMemberWithDependentsById");
> > 		
> > 		ArrayList members = null;
> > 		String sql =
> > "Member.selectMemberWithDependentsById";
> > 		
> > 		Map map = new HashMap();
> > 		map.put("memberId", memberId);
> > 		
> > 		try {
> > 			members = (ArrayList)
> >
>
SASqlMapClientFactory.getSqlMapClient().queryForList(sql,
> > map);
> > 		} catch (SQLException sqlException){
> > 			logger.error(sqlException.getMessage(),
> > sqlException);
> > 			throw new DatabaseException("SQLException
> caught
> > in
> > MemberDAOImpl.selectMemberWithDependentsById.",
> > sqlException);
> > 		}
> > 			
> > 		logger.debug("END -
> > selectMemberWithDependentsById");
> > 		
> > 		return members;
> > 	}
> > 
> > --- Niels Beekman <n.beekman@wis.nl> wrote:
> > 
> > > The code you posted is from a result map, the
> > > exception you're getting
> > > is probably coming from an insert or update, can
> > you
> > > post the Java code
> > > involved and all relevant SQL?
> > > 
> > > Niels
> > > 
> > > -----Original Message-----
> > > From: top de castro
> > > [mailto:rocieldecastro@yahoo.com] 
> > > Sent: Thursday, January 10, 2008 4:40 PM
> > > To: user-java@ibatis.apache.org
> > > Subject: nullValue for Boolean wrapper class
> > > property
> > > 
> > > 
> > > I am using a TypeHandlerCallback to map a
> Boolean
> > > property to a DB2 character(1) field that
> contains
> > > 'T'
> > > or 'F'.   
> > > 
> > > I cannot get the nullValue property to return
> the
> > > value "F" when the database field value is NULL.
> 
> > > The
> > > exception is: 
> > > 
> > >     java.sql.SQLException: Unexpected value null
> > > found
> > > where T or F was expected. 
> > > 
> > > Neither of these work: 
> > >   <result property="cardRequested"
> > column="dp_card"
> > > nullValue="F"/> 
> > >   <result property="cardRequested"
> > column="dp_card"
> > > javaType="Boolean" jdbcType="CHARACTER"
> > > nullValue="F"/> 
> > > 
> > > Any help would be much appreciated! 
> > > 
> > > 
> > > 
> > >  
> > >
> >
>
________________________________________________________________________
> > > ____________
> > > Looking for last minute shopping deals?  
> > > Find them fast with Yahoo! Search.
> > >
> >
>
http://tools.search.yahoo.com/newsearch/category.php?category=shopping
> > > 
> > 
> > 
> > 
> >      
> >
>
________________________________________________________________________
> ____________
> > Be a better friend, newshound, and 
> > know-it-all with Yahoo! Mobile.  Try it now. 
> >
>
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
> > 
> > 
> > 
> 
> 
> 
>  
>
________________________________________________________________________
> ____________
> Looking for last minute shopping deals?  
> Find them fast with Yahoo! Search.
>
http://tools.search.yahoo.com/newsearch/category.php?category=shopping
> 



      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping

Mime
View raw message