You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by I L <is...@hotmail.com> on 2009/08/23 01:47:07 UTC

IBatis 3 backward compatibility

Hi,

I found two scenario's in which used to work in ibatis 2 but no longer works in ibatis 3. 

Scenario 1:

In ibatis 2, you could specify the table name and column name:
e.g.
<result column="user.version" jdbcType="INTEGER" property="version" />
In this case the table is "user" and the column is "version"

With Ibatis 3, if I specify the full column name, "user.version", pojo binding doesn't occur. I must omit the "user." part to just
<result column="version" jdbcType="INTEGER" property="version" />

The ability to have the fully qualified column name is important when you need to distinguish them when both columns are selected from the database.

e.g.
   <result column="user.version" jdbcType="INTEGER" property="version" />
   <result column="place.version" jdbcType="INTEGER" property="version" />

Of course there I could change the column names so they are unique across all tables or use aliasing when necessary. But I thought the ibatis 2 approach was cleaner

Scenario 2:
In ibatis 2, I used to be able to access a pojo property that is complex:

e.g.
<result column="password" property="password.encrypted" jdbcType="VARCHAR" />

So I had a Field of type Password which had and encrypted member. I only want to persist "encrypted"

class Pojo{
  private Password password;
}
class Password{
  private String encrypted; //the encrypted string

  public void getDecryptedString(){...}
}



_________________________________________________________________
Windows Live: Make it easier for your friends to see what you’re up to on Facebook.
http://windowslive.com/Campaign/SocialNetworking?ocid=PID23285::T:WLMTAGL:ON:WL:en-US:SI_SB_facebook:082009