This is a bug that's fixed in the next version. Unfortunately it sets the keygenerator to null instead of a NoKeyGenerator instance.
On Thu, Dec 3, 2009 at 9:33 PM, -dk- <dmitriy.kargapo...@gmail.com> wrote: > > Hi All. > I'm using iBatis 3 beta 5 for Java 6 with ojdbc6.jar (Oracle 11g). > > I got working simple mapper like this: > > public interface RateMapper { > @Select("select rate from rate_table where rate_id = #{id}") > double getRate(int id); > } > > Then I tried to disable cache for this statement: > > public interface RateMapper { > @Options(useCache = false) > @Select("select rate from rate_table where rate_id = #{id}") > double getRate(int id); > } > > and got NullPointerException... > > digging through the code I found it thrown because following statement > returns null: > KeyGenerator keyGenerator = mappedStatement.getKeyGenerator(); > > in the > > org.apache.ibatis.executor.statement.PreparedStatementHandler.parameterize() > method. > > Intuitively adding to the Options "useGeneratedKeys = true" I was able to > get it working again: > ... > @Options(useCache = false, useGeneratedKeys = true) > ... > > How does option "useGeneratedKeys" relate to "useCache" in case of select > statement? > Does it actually relate or it just a side-effect making buggy code > fortunately working? > > Thanks. > > > > -- > View this message in context: > http://old.nabble.com/null-pointer-exception-when-setting-%40Options%28useCache-%3D-false%29-tp26635759p26635759.html > Sent from the iBATIS - User - Java mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org > For additional commands, e-mail: user-java-h...@ibatis.apache.org > >