Tuesday, May 5, 2009

Bugs in IBatis

Hi,
I have been using IBatis for a while and it is really a good ORM solution for small scale applications.

But i found some of the bugs/issues in using IBatis and they are:
Bug#1. If you have a property with the first character as lower case letter and second character as upper case letter and when you define a property map for that bean, IBatis will throw an Exception saying that there is no such property in that bean.

For example:
If i have a class as

public class User
{
private String uId;
public void setUId(String uId){
this.uId = uId;
}
puvlic String getUId(){
return this.uId;
}

}

And if you configure as

<parameterMap class="User" id="UserParamMap">
<parameter property="uId"/>
</parameterMap>

Then IBatis is throwing the following exception:
Caused by: com.ibatis.common.beans.ProbeException: There is no READABLE property named 'uId' in class 'User'.

This is because of the setter/getter semantics used by IBatis.
If the property name uId is changed to userId it will work.

Bug#2.
The bug details are posted Here

1 comment:

  1. Case#1 - it doesn't work because the Java Bean standard around names that have the first 'n' letters in caps is different that that having only the first letter Capital.

    so a method getName() - maps to property name
    while a method getURL - maps to a property URL (caps)

    In your e.g. the method is getUId - which would map to a property UId (U & I) are caps. It isn't a IBatis convention - that's the standard at work!

    ReplyDelete