ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick R <ric...@gmail.com>
Subject Re: why is ibatis rolling up for an association, not sure why this isn't flat, or what its rolling up on?
Date Mon, 22 Feb 2010 04:19:24 GMT
On Sun, Feb 21, 2010 at 10:50 PM, Clinton Begin <clinton.begin@gmail.com>wrote:

> Oh... also put an <id> element on the parent (likee parentValueID?).
Ok that's even more weird now. When I changed:

<result column="parentValueID" property="parentValueID" jdbcType="INTEGER"
<id property="parentValueID" column="parentValueID" jdbcType="INTEGER"/>

I now end up with 6 of the rows mapped to objects (instead of 7 without it
.. and remember there should be 13 objects total.)

> Also, be careful with automapping and nested results.  In Beta 9 I added
> configuration to disable automapping for nested results, only because it was
> confusing where the results would end up.  But that doesn't look like a
> problem here, as you don't have conflicting property names.

I'm curious what part I'm automapping? I thought I was doing it just as I
saw in your blog example in the PDF?

I even changed it a bit to be more like your example (not that in my case
I'd think I would need to get the value of attributeValueID more than once.)

         aga.attributeValueID as parent_avID,

  <resultMap id="ProdAttrGroupAttrValueResultWithAttributeValue"
        <id property="parentValueID" column="parentValueID"
        <result column="defaultValueFlag" property="defaultValueFlag"
jdbcType="CHAR" />
        <result column="objectType" property="objectType" jdbcType="VARCHAR"
        <!--<result column="parentValueID" property="parentValueID"
jdbcType="INTEGER" />  -->
        <association property="attributeValue" column="parent_avID"
            <id property="attributeValueID" column="attributeValueID"
            <result column="value" property="value" jdbcType="VARCHAR"/>
            <result column="attributeValueDesc"
property="attributeValueDesc" jdbcType="VARCHAR" />
            <result column="requiredFlag" property="requiredFlag"
jdbcType="CHAR" />

To Guy's point, not sure if the object's I'm mapping to matter? but if so:

public class ProdAttrGroupAttrValue extends BaseModel {
    private String defaultValueFlag;
    private String objectType;
    private Integer parentValueID;
    private Integer productID;
    private Integer sequenceNumber;

    private AttributeValue attributeValue; //the association object I'm
trying to populate

    private AttributeGroup attributeGroup; //not used here

public class AttributeValue extends BaseModel {
    private List<AttributeValue> attributeValueDependencies; //not used here
in this query
    private Integer attributeValueID;
    private String value;
    private String attributeValueDesc;
    private String requiredFlag;
    //... set/gets

I'm sure this is going to come down to a typo or something. I can just feel
it, because it seems like I'm doing things correctly?

View raw message