ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Farsi, Reza" <Reza.Fa...@SUNGARD.DE>
Subject AW: Question on SQLMaps
Date Fri, 23 Sep 2005 13:01:29 GMT
Hi Tajeev,

Names in select, update, etc. have to be seen globaly. That means, if you have e.g. getAll
for three objects, you have to either change the names (getAllBooks, getAllCds, getAllFilms),
or you have to use namespace.

You only need to activate using of namespaces in your configuration file by defining:
<sqlMapConfig>
	<settings
		useStatementNamespaces="true" 
	/>
	...
</sqlMapConfig>

Hope it helps.

Reza

-----Urspr√ľngliche Nachricht-----
Von: Dave, Rajeev [mailto:Rajeev.Dave@FMR.COM] 
Gesendet: Freitag, 23. September 2005 14:52
An: user-java@ibatis.apache.org
Betreff: RE: Question on SQLMaps

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