[
https://issues.apache.org/jira/browse/IBATISNET-45?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12683674#action_12683674
]
Russ Baker commented on IBATISNET-45:
-------------------------------------
I'm seeing this issue again with Ibatis for Java. I'm using
ibatis-sqlmap-2.3.4.726.jar. It works for some sql maps, but not for others. I
haven't been able to track down why one works and the other doesn't. Here is an
example:
sqlMapConfig:
<sqlMapConfig>
<properties resource="database.properties"/>
<settings enhancementEnabled="true" useStatementNamespaces="true"/>
...
SqlMap 1:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-2.dtd" >
<sqlMap namespace="GRANULE" >
<typeAlias alias="granule" type="gov.noaa.eds.ri.api.dto.GranuleDTO" />
<resultMap id="granuleResult" class="gov.noaa.eds.ri.api.dto.GranuleDTO" >
<!--
WARNING - This element is automatically generated by Abator for iBATIS,
do not modify.
This element was generated on Thu Oct 30 13:02:24 MDT 2008.
-->
<result column="ID" property="id" jdbcType="DECIMAL" />
<result column="START_DATE" property="start_date" jdbcType="TIMESTAMP" />
<result column="END_DATE" property="end_date" jdbcType="TIMESTAMP" />
<result column="DESCRIPTION" property="description" jdbcType="VARCHAR" />
<result column="GRANULE_TYPE_ID" property="granuleTypeId"
jdbcType="DECIMAL" />
<result column="LAST_UPDATE_DATE" property="lastUpdateDate" jdbcType="DATE"
/>
<result column="LAST_UPDATED_BY_USER" property="lastUpdateByUser"
jdbcType="VARCHAR" />
</resultMap>
sqlMap2 which uses result map from sqlMap 1
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-2.dtd" >
<sqlMap namespace="DATA_SEGMENT" >
<select id="findGranuleByDataSegment" parameterClass="java.lang.Long"
resultMap="GRANULE.granuleResult">
I get the following error:
Caused by: java.lang.RuntimeException: Error parsing XPath
'/sqlMapConfig/sqlMap'. Cause: com.ibatis.common.xml.NodeletException: Error
parsing XML. Cause: java.lang.RuntimeException: Error parsing XPath
'/sqlMap/select'. Cause: com.ibatis.sqlmap.client.SqlMapException: There is no
result map named GRANULE.granuleResult in this SqlMap.
Is this a regression, or do I not have things configured conrrectly?
> Unable to reference result maps defined in other xml files when
> useStatementNamespaces is set to true
> -----------------------------------------------------------------------------------------------------
>
> Key: IBATISNET-45
> URL: https://issues.apache.org/jira/browse/IBATISNET-45
> Project: iBatis for .NET
> Issue Type: Bug
> Environment: DataMapper: 1.1.458.0
> Reporter: Ron Grabowski
> Assignee: Gilles Bayon
> Priority: Minor
> Fix For: DataMapper 1.2.0
>
>
> If I try to access a result map in a different namespace using this syntax:
> <sqlMap namespace="XYZ" ...>
> <statements>
> <select id="GetMany" resultMap="ABC.FooResult" parameterClass="map">
> I get an exception complaining that resultMap XYZ.ABC.FooResult is not
> defined. ABC.FooResult is defined in a seperate xml file. In my SqlMap.config
> file, the xml file containing ABC.FooResult appears before the XYZ resultmap
> file:
> <sqlMaps>
> <sqlMap resource="ABC.xml" />
> <sqlMap resource="XYZ.xml" />
> </sqlMaps>
> Java people in the #ibatis chatroom (Brandon and Larry) said that to
> reference a external result map, you needed to do so before the id tag:
> <sqlMap namespace="XYZ" ...>
> <statements>
> <select resultMap="ABC.FooResult" id="GetMany" parameterClass="map">
> That didn't work in IBatisNet.
> I also tried creating a local resultmap that extended an external resultmap:
> <sqlMap namespace="XYZ" ...>
> <resultMaps>
> <resultMap id="FooResult" extends="ABC.FooResult" />
> </resultMaps>
> <statements>
> <select id="GetMany" resultMap="FooResult" parameterClass="map">
> I received an exception saying something about ABC.FooResult not being found.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.