You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Jeff P <ki...@hotmail.com> on 2009/01/17 05:26:58 UTC

parameterMap accesible from multiple sql maps not working

The manuals says this:
"Note! Parameter Map names are always local to the SQL Map XML file that
they are defined in. You can
refer to a Parameter Map in another SQL Map XML file by prefixing the id of
the Parameter Map with the
id of the SQL Map (set in the <sqlMap> root tag). For example, to refer to
the above parameter map from a
different file, the full name to reference would be
“Product.insert-product-param”."

how come this:

sqlMap file #1:
<sqlMap namespace="TableType" >
    <parameterMap id="SyncDatesMap" class="SyncDates" >
        <parameter property="oldSyncDate" jdbcType="TIMESTAMP"
javaType="Date" />
        <parameter property="currentSyncDate" jdbcType="TIMESTAMP"
javaType="Date" />
    </parameterMap>
</sqlMap>

sqlMap file #2:
<sqlMap namespace="ColumnGroup" >
    <select id="countUnsyncedByDate" parameterMap="TableType.SyncDatesMap"
resultClass="Integer">
query here
    </select>
</sqlMap>


gives me this exception:
com.ibatis.sqlmap.client.SqlMapException: There is no parameter map named
TableType.SyncDatesMap in this SqlMap.


How can I tell iBatis to look in sqlMap with namespace "TableType" rather
than staying in "ColumnGroup"?
Thanks in advance
-- 
View this message in context: http://www.nabble.com/parameterMap-accesible-from-multiple-sql-maps-not-working-tp21513021p21513021.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Re: parameterMap accesible from multiple sql maps not working

Posted by Jeff P <ki...@hotmail.com>.

I seem to have stumbled across the answer thanks to Jeff Butler.
http://www.nabble.com/forum/ViewPost.jtp?post=14703945&framed=y

I changed the order the sqlMaps get loaded in the SQLMapConfig and that
solved it! However I have one more question. 

I got this error thrown at me: 
com.ibatis.sqlmap.client.SqlMapException: There is already a statement named
countUnsyncedByDate in this SqlMap.

When I renamed the id of one of the <select></select>-operation to something
else this error was not thrown. I assumed names are always local to the SQL
Map XML file. Is this not the case for database operations (select, update,
delete etc.)?

Thanks
Jeff


Jeff P wrote:
> 
> The manuals says this:
> "Note! Parameter Map names are always local to the SQL Map XML file that
> they are defined in. You can
> refer to a Parameter Map in another SQL Map XML file by prefixing the id
> of the Parameter Map with the
> id of the SQL Map (set in the <sqlMap> root tag). For example, to refer to
> the above parameter map from a
> different file, the full name to reference would be
> “Product.insert-product-param”."
> 
> how come this:
> 
> sqlMap file #1:
> <sqlMap namespace="TableType" >
>     <parameterMap id="SyncDatesMap" class="SyncDates" >
>         <parameter property="oldSyncDate" jdbcType="TIMESTAMP"
> javaType="Date" />
>         <parameter property="currentSyncDate" jdbcType="TIMESTAMP"
> javaType="Date" />
>     </parameterMap>
> </sqlMap>
> 
> sqlMap file #2:
> <sqlMap namespace="ColumnGroup" >
>     <select id="countUnsyncedByDate" parameterMap="TableType.SyncDatesMap"
> resultClass="Integer">
> query here
>     </select>
> </sqlMap>
> 
> 
> gives me this exception:
> com.ibatis.sqlmap.client.SqlMapException: There is no parameter map named
> TableType.SyncDatesMap in this SqlMap.
> 
> 
> How can I tell iBatis to look in sqlMap with namespace "TableType" rather
> than staying in "ColumnGroup"?
> Thanks in advance
> 





-- 
View this message in context: http://www.nabble.com/parameterMap-accesible-from-multiple-sql-maps-not-working-tp21513021p21513121.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.