It seems possible to do so if I declare my ControlMapper before SampleMapper.
Unfortunetly, since both mappers depends on each other, I'm stuck...

Could it be possible for the builder to read all XML files before trying to 
resolve dependencies. That way, if 2 mappers depend on each other the builder 
wouldn't crash.

Christian

________________________________
From: Poitras Christian [mailto:christian.poit...@ircm.qc.ca]
Sent: Friday, September 18, 2009 3:16 PM
To: 'user-java@ibatis.apache.org'
Subject: iBATIS 3 include

Hi,

Is it possible to include an sql segment from another mapper?
In SampleMapper, I've defined columns for sample base class.

<sql id="columns">

Sample.oid AS 'Sample.oid',

Sample.name AS 'Sample.name',

Sample.sampleType AS 'Sample.sampleType',

Sample.userExperimentationOid AS 'Sample.userExperimentationOid',

Sample.userOid AS 'Sample.userOid',

Sample.comments AS 'Sample.comments'

</sql>

I want to include them in mapper of a subclass of Sample

<sql id="columns">

<include refid="ca.qc.ircm.lims.persistence.mapper.SampleMapper.columns"/>,

Sample.oid AS 'Sample.oid',

Control.tag AS 'Control.tag',

Control.support AS 'Control.support',

Control.volume AS 'Control.volume',

Control.quantity AS 'Control.quantity',

Control.quantityUnit AS 'Control.quantityUnit',

Control.standard AS 'Control.standard'

</sql>

But it gives me an exception

nested exception is org.apache.ibatis.builder.BuilderException: Error parsing 
SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing 
Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Could not find 
SQL statement to include with refid 
'ca.qc.ircm.lims.persistence.mapper.SampleMapper.columns'

Since my Sample class has many subclasses, I don't want to write the same 
column names again and again...

Thanks.
Christian

Reply via email to