ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Poitras Christian <Christian.Poit...@ircm.qc.ca>
Subject RE: iBATIS 3 include
Date Fri, 18 Sep 2009 19:26:22 GMT
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.


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


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'


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'


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...


View raw message