ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Larry Meadors <larry.mead...@gmail.com>
Subject Re: Question on SQLMaps
Date Fri, 23 Sep 2005 14:28:37 GMT
The key there is this: "There is already a statement named getId in
this SqlMap."

As others have mentioned, you have to make the names unique, or enable
namespaces.

I would suggest using namespaces. It makes things much cleaner in
terms of organization.

Larry


On 9/23/05, Dave, Rajeev <Rajeev.Dave@fmr.com> wrote:
> Sorry, I missed mentioning in my last mail that as of now, it gives the
> following error
>
> com.ibatis.common.exception.NestedRuntimeException: Error occurred.
> Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.
> Cause: com.ibatis.common.exception.NestedRuntimeException: Error parsing
> XPath '/sqlMapConfig/sqlMap'.  Cause:
> com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause:
> com.ibatis.common.exception.NestedRuntimeException: Error parsing XPath
> '/sqlMap/select'.  Cause: com.ibatis.sqlmap.client.SqlMapException:
> There is already a statement named getId in this SqlMap.
> Caused by: com.ibatis.sqlmap.client.SqlMapException: There is already a
> statement named getId in this SqlMap.
> Caused by: com.ibatis.common.exception.NestedRuntimeException: Error
> parsing XPath '/sqlMap/select'.  Cause:
> com.ibatis.sqlmap.client.SqlMapException: There is already a statement
> named getId in this SqlMap.
> Caused by: com.ibatis.sqlmap.client.SqlMapException: There is already a
> statement named getId in this SqlMap.
> Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML.
> Cause:
>
> -----Original Message-----
> From: Dave, Rajeev
> Sent: Friday, September 23, 2005 6:18 PM
> To: user-java@ibatis.apache.org
> Subject: Question on SQLMaps
>
>
> Hello,
> The following is the scenario
> 1. I have a SQLMapConfig.xml which contains 2 sqlmap declarations. E.g.
> <....
>   <sqlMap resource="Dimension.xml" />
>   <sqlMap resource="Hierarchy.xml" />
> >
>
> 2. In each of the SQLMap xml's I have some select declarations
>
> <sqlMap namespace="DimensionQuery">
>   <select id="getId" resultClass="mypackage.Dimension">
>     select dim_id as dimId from dim_table where dim_nm = #value#
>   </select>
> </sqlMap>
> <sqlMap namespace="HierarchyQuery">
>   <select id="getId" resultClass="mypackage.Hierarchy">
>     select hier_id as hierId from hier_table where hier_ds = #value#
>   </select>
> </sqlMap>
>
> Here please note that I have the same Id (getId) in both the sql map
> declarations.
>
> Here is my question.
>
> Is it possible to reuse the same id's across sqlmap xml's.
> I will appreciate if someone can help me here on this
>
> Rgds,
> Rajeev Dave
>

Mime
View raw message