<include> tag takes sql fragments only from same xml

59 views
Skip to first unread message

Paweł P.

unread,
Jun 7, 2010, 4:45:42 AM6/7/10
to mybatis-user
I'm going to have a lot of mapper xml file.
But there is a problem with "<include>" tag, it takes sql fragments
only from mapper file it exist in.

Best regard
Paweł

Larry Meadors

unread,
Jun 7, 2010, 7:58:13 AM6/7/10
to mybati...@googlegroups.com
Have you tried adding the namespace to the sql fragment?

I haven't, but that was how i2 worked.

Larry

Paweł P.

unread,
Jun 8, 2010, 4:01:57 AM6/8/10
to mybatis-user
I checked, with namespace doesn't work, too.

Paweł

Paweł P.

unread,
Jun 17, 2010, 1:43:04 AM6/17/10
to mybatis-user
Is there any chance for solution?
I think problem is quite serious in big applications.

Paweł

Poitras Christian

unread,
Jun 17, 2010, 9:07:34 AM6/17/10
to mybati...@googlegroups.com
What version of iBATIS are you using?

In MyBatis, I do that in many XML files :
<mapper namespace="ca.qc.ircm.lims.persistence.mapper.treatment.NegativeControlMapper">
<select id="selectById" resultMap="negativeControlMap" parameterType="long">
SELECT <include refid="ca.qc.ircm.lims.persistence.mapper.SampleMapper.negativeControlColumns"/>
FROM Control
JOIN Sample ON Sample.id = Control.id
WHERE Control.id = #{id}
</select>

In this case, I must include SampleMapper before NegativeControlMapper in my config file or it throws an exception.

Christian

Reply all
Reply to author
Forward
0 new messages