ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tracey Annison" <tanni...@trisystems.co.uk>
Subject RE: Problem with using generic and specific custom TypeHandlers
Date Mon, 15 May 2006 07:32:14 GMT
Well, initially I didn't have the <typeHandlers>, just the individual
<typeHandler> elements in there. But was advised to add that
<typeHandlers> in. But it makes absoluteloy no difference anyway - the
generic TypeHandlerStringANYEnum defined in there works fine with or
without it!

But the specific TypeHandlerStringYNBoolean that I want to make work on
just one field doesn't even get called...

Cheers
Tracey Annison

-----Original Message-----
From: Niels Beekman [mailto:n.beekman@wis.nl] 
Sent: 15 May 2006 08:32
To: user-java@ibatis.apache.org
Subject: RE: Problem with using generic and specific custom TypeHandlers

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




----------------------------------------------------------------------
The information in this email is confidential and may be legally privileged. 
It is intended solely for the addressee. Access to this email by 
anyone else is unauthorised. If you are not the intended recipient, 
any disclosure, copying, distribution, or any action taken or omitted 
to be taken in reliance on it, is prohibited and may be unlawful. 
TriSystems Ltd. cannot accept liability for statements made which are clearly
the sender's own.



Mime
View raw message