ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martín Capote <mcap...@mercurio.dgr.gub.uy>
Subject Generics and _There is no WRITEABLE property_ exception
Date Thu, 07 Aug 2008 18:37:22 GMT
Hi, sorry for my english, I speak spanish.
I have a question about generics.
I have an application running with ibatis 2.3.0, and I tried to 'generify'
some parts.
I introduce the "Keyable" interface:
public interface Keyable<K extends Key> {
    public K getKey();
    public void setKey(K key);

The Key is a simple abstract class:

public abstract class Key  {
    public Key() {

Then, I declare my business object in this way :

public class Person implements Keyable<PersonKey> {

public class PersonKey extends Key {
    private String code;

And declare the resultMap in this way:
    <resultMap id="PersonResult" class="Person">
        <result property="key.code" column="CODE" />

But i get this error:

Caused by: com.ibatis.common.beans.ProbeException: There is no WRITEABLE
property named 'code' in class 'com.pack.Key'

My first (and naive, I think) solution is:

- add the getPersonKey() method to the Person class (which returns
explicitly the PersonKey)
- modify the resultMap, so that the property look like this:

But is an ugly solution, and a lot of work. 
And I want to retain the generics.
There is some better solution to this problem? 

View raw message