ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bret Gregory" <bret.greg...@reged.com>
Subject Sub-List in Result Map Problem.
Date Thu, 03 Nov 2005 21:16:05 GMT
I am having a problem with nested resultmaps and the sub-lists.  I have
2 Result Maps.  One contains a collection
Of the second map.  The second map maps a complex property.  When I
execute the query and the are no properties that are
Related, I still get a property in the properties collection.  The
property is not persisted and is all default or NULL values. 
I want the properties property of CronJobDefinition to be empty if not
matches are found in the database.  Is this possible in iBatis?

Below are my result map definitions:
<resultMap id="CronJobDefinition"
class="com.reged.model.cron.CronJobDefinition" groupBy="cronJobId">
     	<result property="cronJobId" column="cronJobId" javaType="int"
jdbcType="NUMERIC" nullValue="-1"/>
     	<result property="className" column="jobClass"
javaType="java.lang.String" jdbcType="VARCHAR"/>
     	<result property="frequency.frequencyId" column="frequencyId"
javaType="int" jdbcType="NUMERIC" nullValue="-1"/>
     	<result property="frequency.type" column="frequencyType"
javaType="java.lang.String" jdbcType="VARCHAR"/>
     	<result property="frequency.description"
column="frequencyDescription" javaType="java.lang.String"
jdbcType="VARCHAR"/>
     	<result property="description" column="jobDescription"
javaType="java.lang.String" jdbcType="VARCHAR"/>
     	<result property="active" column="Active" javaType="boolean"
jdbcType="BIT" nullValue="false"/>
     	<result property="companyId" column="CompanyId" javaType="int"
jdbcType="NUMERIC" nullValue="-1"/>
<result property="properties"
resultMap="CronJob.CronJobPropertyDefinition"/>     	
</resultMap>

<resultMap id="CronJobPropertyDefinition"
class="com.reged.model.cron.CronJobPropertyDefinition">
    	<result property="cronJobPropertyId" column="cronJobPropertyId"
javaType="int" jdbcType="NUMERIC" nullValue="-1"/>
     	<result property="className" column="propertyClass"
javaType="java.lang.String" jdbcType="VARCHAR"/>
	<result property="key" column="key" javaType="java.lang.String"
jdbcType="VARCHAR"/>
	<result property="value" column="Value"
javaType="java.lang.String" jdbcType="VARCHAR"/>   	
<result property="description" column="propertyDescription"
javaType="java.lang.String" jdbcType="VARCHAR"/>
	<result property="type.cronJobPropertyTypeId" column="typeId"
javaType="int" jdbcType="NUMERIC" nullValue="-1"/>
	<result property="type.type" column="type"
javaType="java.lang.String" jdbcType="VARCHAR"/>
	<result property="type.description" column="typeDescription"
javaType="java.lang.String" jdbcType="VARCHAR"/>
	<result property="type.className"  column="propertyClass"
javaType="java.lang.String" jdbcType="VARCHAR"/>
	<result property="type.keyLabel" column="keyLabel"
javaType="java.lang.String" jdbcType="VARCHAR"/>
	<result property="type.isAttribute" column="attribute"
javaType="boolean" jdbcType="BIT" nullValue="false"/>
	<result property="type.valueLabel" column="valueLabel"
javaType="java.lang.String" jdbcType="VARCHAR"/>
</resultMap>

Mime
View raw message