ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pere Torrodellas" <ptorrodel...@fihoca.com>
Subject iBATIS strange behaviour
Date Thu, 06 Oct 2005 13:19:03 GMT
I ran into this strange problem that required a lot of time to debug. This
is just to try to save trouble for those that run into it.

iBATIS version: 2.1.5

This first data map works OK:

<typeAlias alias="Oferta" type="gov.soc.web.model.ofertes.Oferta"/>
<select id="getOferta" parameterClass="java.lang.Integer"
        ID_OFERTA as iIdOferta,
        OCUPACIO as stOcupacio,
        MUNICIPIO as stLocalitat
    from OFERTAS
    where ID_OFERTA = #value#

But this one throws an exception:

<typeAlias alias="Oferta" type="gov.soc.web.model.ofertes.Oferta"/>
<resultMap id="getOfertaResult" class="Oferta">
    <result property="iIdOferta" column="ID_OFERTA"/>
    <result property="stOcupacio" column="OCUPACIO"/>
    <result property="stLocalitat" column="MUNICIPIO"/>
<select id="getOferta" parameterClass="java.lang.Integer"
   from OFERTAS
   where ID_OFERTA = #value#

Note that result class, property names and table are the same in both cases.

The exception says:

com.ibatis.common.beans.ProbeException: There is no WRITEABLE property named
'iIdOferta' in class 'gov.soc.web.model.ofertes.Oferta'

...which is wrong because I checked umpteen times property name and setter
method, and what's more: it works with the first data map format.

Commenting out the <result> tag for the iIdOferta property, the second data
map format also works OK.

After many, many tests and Mail Archive searches, I tried in despair a last
one: I changed the property name from iIdOferta to inIdOferta, together with
its getter/setter... IT WORKED!!!

So... is this an iBATIS bug? Doesn't it like property names that start with
a lowercase letter followed by an uppercase letter? If so, why does it work
with the first data map format? Can someone offer an explanation?

Just be warned.



View raw message