ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Reuben Firmin" <reub...@benetech.org>
Subject Enum handling problem with subquery / list
Date Fri, 04 Apr 2008 01:52:41 GMT

I'm having a problem handling enums from a subquery. I have a type handler
registered for the enums, but it doesn't seem to be called.

Essentially, on my result map, I have a subquery like this:

<result property="roles" column="user_account_id" select="getRoles" />

This corresponds to:

    public void setRoles(List<UserRole> roles) {
        this.roles = roles;

UserRole is an enum, i.e.

public enum UserRole implements HasValue<String> {


The getRoles statement looks like this:

<select id="getRoles" parameterClass="int" resultClass="userRoleClass">

Instead of invoking the TypeHandler on each of the results, the flow instead
goes into JavaBeansDataExchange.setData, which eventually tries to
instantiate UserRole, which fails, because it is an enum. I verified that
the TypeHandler is actually being registered in TypeHandlerFactory, but the
TypeHandler's methods are never called.

As a further test, I also set the result mapping to be:
<result property="roles" column="user_account_id" select="getRoles"
This didn't result in the TypeHandler's methods being called either, which
leads me to suspect that the issue is something to do with there being a
list of results.

Any ideas on further debugging that I can do, and/or a solution? (I realize
that 2.3.1 may solve this, but I can't use it until it's non-beta.)


View raw message