ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From I L <iss...@hotmail.com>
Subject RE: Ibatis 3.0 Bugs/Suggestions
Date Sun, 16 Aug 2009 16:38:02 GMT

Found a very small performance (milliseconds) change:


In BaseTypeHandler.getResult

Instead of:
    Object result = getNullableResult(rs, columnName);
    if (rs.wasNull()) {
      return null;
    } else {
      return result;
    }

I would put the getNullableResult in the else part of the conditional:
    
    if (rs.wasNull()) {
      return null;
    } else {
      Object result = getNullableResult(rs, columnName);
      return result;
    }


> Date: Sat, 15 Aug 2009 22:24:40 -0600
> Subject: Re: Ibatis 3.0 Bugs/Suggestions
> From: clinton.begin@gmail.com
> To: user-java@ibatis.apache.org
> 
> Excellent feedback. I'll start looking into these tomorrow.  Thanks.
> 
> Clinton
> 
> On Sat, Aug 15, 2009 at 7:31 PM, I L<isster@hotmail.com> wrote:
> > Hi,
> >
> > Awesome product renovation.
> >
> > Heres some things I found that might have already been discussed:
> >
> > 1) http://ibatis.apache.org/dtd/ibatis-3-mapper.dtd
> > Getting error if I try to add either <typeAliases> or <typeAlias> in
a
> > mapper xml file. Works only in a Configuration.xml file.
> >
> > 2) session.select
> > I am able to invoke the three param .select(arg0, arg1, arg2) but not
> > .select(id, param). The id/param select isn't available.
> >
> > There is no examples in the pdf on how to use the three param select.
> >
> > 3) Is there anyway we can keep the colon syntax for defining jdbcType. It
> > could be in addition to the comma seperated diffinations. Just looks cleaner
> > and is much shorter:
> > e.g. #{timeZone,jdbcType=VARCHAR} vs #{timeZone:VARCHAR}
> >
> > e.g.
> >    count != #{usercount,jdbcType=BIGINT} vs count != #{usercount:BIGINT}
> >
> >
> > 4) It would be nice to have a more straight forward way to get access to
> > Connection
> >
> > sqlSession.getConfiguration().getEnvironment().getDataSource().getConnection();
> >        vs
> >        sqlSession.getConnection();
> >
> > 5)
> >     <select id="isUniqueUsername"  parameterType="map"
> > resultType="boolean">
> >         SELECT (count(*) = 0)
> >         FROM user Where 1=0
> >     </select>
> >
> > If I access this select the old fashion way:
> >        ((Boolean) getSession().selectOne("User.isUniqueUsername",
> > map)).booleanValue();
> >
> > ... I get a "Casting Exception". Apparently a Long is returned instead of a
> > Boolean. I am running on a mysql database. As you know, mysql deals with
> > booleans as bits (1's or 0's). Oddly enough this works fine in the ibatis
> > 2.x versions.
> >
> > 6) Not sure if this will be of any use to anyone, but I've written a
> > CalendarTypeHandler. On the surface, it seems to be working fine
> >
> >
> > public class CalendarTypeHandler extends BaseTypeHandler {
> >
> >     public void setNonNullParameter(PreparedStatement ps, int i, Object
> > parameter, JdbcType jdbcType) throws SQLException {
> >         Calendar calendar = (Calendar) parameter;
> >         ps.setTimestamp(i, (new Timestamp(calendar.getTimeInMillis())));
> >     }
> >
> >     public Object getNullableResult(ResultSet rs, String columnName) throws
> > SQLException {
> >         java.sql.Timestamp sqlTimestamp = rs.getTimestamp(columnName);
> >         if (sqlTimestamp != null) {
> >             return new java.util.Date(sqlTimestamp.getTime());
> >         }
> >         return null;
> >     }
> >
> >     public Object getNullableResult(CallableStatement cs, int columnIndex)
> > throws SQLException {
> >         java.sql.Timestamp sqlTimestamp = cs.getTimestamp(columnIndex);
> >         if (sqlTimestamp != null) {
> >             return new java.util.Date(sqlTimestamp.getTime());
> >         }
> >         return null;
> >     }
> >
> > }
> >
> > 7) Picky user guide stuff
> > The User guide is overall very clean, complete, and clear. Great job!!!
> >
> > a)"....There are two TransactionManager types (i.e. type=”?????”) that are in...".
> > What is the ???? suppose to be?
> > b) An explanation about the Enum type handler would be nice (like what's
> > persisted, code or index. Is it configurable?)
> > c)
> > "The iBATIS XML configuration file is contains settings and properties that have
a dramatic effect on how..."
> > Get rid of "is"
> >
> > 8) What .selectOne() is isn't clear. Maybe a note that an exception will be
> > thrown if either a list or a null is returned?
> >
> >
> > Thats all I have found so far. Cheers!
> >
> >
> > ________________________________
> > Windows Live™: Keep your life in sync. Check it out.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
> 

_________________________________________________________________
Windows Live: Keep your friends up to date with what you do online.
http://windowslive.com/Campaign/SocialNetworking?ocid=PID23285::T:WLMTAGL:ON:WL:en-US:SI_SB_online:082009
Mime
View raw message