ibatis-user-java mailing list archives

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

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.
http://windowslive.com/explore?ocid=PID23384::T:WLMTAGL:ON:WL:en-US:NF_BR_sync:082009
Mime
View raw message