ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niels Beekman" <n.beek...@wis.nl>
Subject RE: Problem with using generic and specific custom TypeHandlers
Date Mon, 15 May 2006 07:32:13 GMT
Are you using the DTD for your sqlmap configfile? There is no such
element "typeHandlers"...

Niels

-----Original Message-----
From: Tracey Annison [mailto:tannison@trisystems.co.uk] 
Sent: maandag 15 mei 2006 9:20
To: user-java@ibatis.apache.org
Subject: RE: Problem with using generic and specific custom TypeHandlers

Thanks, Ben. 

Well, I now have XML like this : 

Generic TypeHandler in the sql-map-config.xml- 
===================================
<typeHandlers>
	<typeHandler javaType="uk.co.package.user_type.FlagANY"
callback="uk.co.package.utils.TypeHandlerStringANYEnum"/>
</typeHandlers>
===================================


And in the thing.xml I have a ResultMap and ParameterMap like this - 
===================================
<resultMap id="thingResult"
class="uk.co.package.persistence.ThingIbatis">
        <result column="OCFRED" property="fred"/>
        <result column="OCBILL" property="bill"
typeHandler="uk.co.package.utils.TypeHandlerStringYNBoolean"/>
</resultMap>

<parameterMap id="thingResult"
class="uk.co.package.persistence.ThingIbatis">
        <parameter  property="fred"/>
        <parameter property="bill"
typeHandler="uk.co.package.utils.TypeHandlerStringYNBoolean"/>
/parameterMap>
===================================


And I have Java code like this for ThingIbatis - 
===================================
import uk.co.package.user_type.FlagANY;

public class ThingIbatis implements Comparable<ThingIbatis> {

    private FlagANY fred = FlagANY.N;
    private Boolean bill = FlagYN.getDefaultBoolean();


    public FlagANY getFred() {
        return this.fred;
    }

    public Boolean getBill() {
        return this.bill;
    }

    public void setFred(FlagANY fred) {
        this.fred = fred;
    }

    public void setBill(Boolean bill) {
        this.bill = bill;
    }
}
===================================

And I'm still not getting the specific TypeHandler called. The
TypeHandlerStringANYEnum works fine for fred, but the
TypeHandlerStringYNBoolean is never invoked for bill.


I can't see what else I ought to be doing...

Cheers
Tracey Annison


Mime
View raw message