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 _Eric_ <er...@web.de> on 2009/01/15 13:44:06 UTC

include SQL mapping file

Hi all,

I have one mapping file for every message type I send. There is an error
handling used in every message type. So I want to put it in an seperate
mapping config:

<sqlMap namespace="Error">
	<typeAlias alias="Error" type="de.blah.database.type.ZdaError" />
	<resultMap id="ErrorMap" class="Error" >
	        <result property="code" column="code" />
 		<result property="message" column="message" />
 	</resultMap>

  	<select id="getError" parameterClass="int" resultMap="ErrorMap" >
 		SELECT code, message FROM error WHERE id=#value#
	</select>
</sqlMap>


To use it I used the select with the name space :<result property="error" 
column="error" select="Error.getError"/>
And put the sqlMap resource into the sqlMapConfig.

The result is an iBatis error: Cause:
com.ibatis.sqlmap.client.SqlMapException: There is no statement named
Error.getError in this SqlMap.

How can I reuse in sveral mapping files?

Greetings
Eric


-- 
View this message in context: http://www.nabble.com/include-SQL-mapping-file-tp21476828p21476828.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


RE: include SQL mapping file

Posted by yashiro <rg...@gmail.com>.
If you alredy have added the sql maps on the sql map config then you shuuld
enable the useStatementNamespaces like this:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE sqlMapConfig PUBLIC "-//ibatis.apache.org//DTD SQL Map Config
2.0//EN" "http://ibatis.apache.org/dtd/sql-map-config-2.dtd">
<sqlMapConfig>
.......
<settings useStatementNamespaces="true" /> 
.
.
.
</sqlMapConfig>
-- 
View this message in context: http://www.nabble.com/include-SQL-mapping-file-tp21476828p21481362.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


RE: include SQL mapping file

Posted by _Eric_ <er...@web.de>.
Thanks for your sugestion, but doesn't change anything :-(


Young, Alistair wrote:
> 
> Just one thought: in your SqlMapConfig file, have you included your
> ErrorMap.xml (or whatever it's called) BEFORE the SqlMap which is trying
> to use it?
> 
> I've seen problems caused by this in the past.
> 
> 
> Alistair.
> 
> -----Original Message-----
> From: _Eric_ [mailto:eric_@web.de] 
> Sent: 15 January 2009 12:44
> To: user-java@ibatis.apache.org
> Subject: include SQL mapping file
> 
> 
> Hi all,
> 
> I have one mapping file for every message type I send. There is an error
> handling used in every message type. So I want to put it in an seperate
> mapping config:
> 
> <sqlMap namespace="Error">
> 	<typeAlias alias="Error" type="de.blah.database.type.ZdaError"
> />
> 	<resultMap id="ErrorMap" class="Error" >
> 	        <result property="code" column="code" />
>  		<result property="message" column="message" />
>  	</resultMap>
> 
>   	<select id="getError" parameterClass="int" resultMap="ErrorMap"
>>
>  		SELECT code, message FROM error WHERE id=#value#
> 	</select>
> </sqlMap>
> 
> 
> To use it I used the select with the name space :<result
> property="error" 
> column="error" select="Error.getError"/> And put the sqlMap resource
> into the sqlMapConfig.
> 
> The result is an iBatis error: Cause:
> com.ibatis.sqlmap.client.SqlMapException: There is no statement named
> Error.getError in this SqlMap.
> 
> How can I reuse in sveral mapping files?
> 
> Greetings
> Eric
> 
> 
> --
> View this message in context:
> http://www.nabble.com/include-SQL-mapping-file-tp21476828p21476828.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
> 
> 
> 
> Please help Logica to respect the environment by not printing this email 
> /  Merci d'aider Logica à préserver l'environnement en évitant d'imprimer
> ce mail /  Bitte drucken Sie diese Nachricht nicht aus und helfen Sie so
> Logica dabei die Umwelt zu schuetzen  /  Por favor ajude a Logica a
> respeitar o ambiente não imprimindo este correio electrónico.
> 
> 
> 
> This e-mail and any attachment is for authorised use by the intended
> recipient(s) only. It may contain proprietary material, confidential
> information and/or be subject to legal privilege. It should not be copied,
> disclosed to, retained or used by, any other party. If you are not an
> intended recipient then please promptly delete this e-mail and any
> attachment and all copies and inform the sender. Thank you.
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/include-SQL-mapping-file-tp21476828p21478214.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


RE: include SQL mapping file

Posted by "Young, Alistair" <al...@logica.com>.
Just one thought: in your SqlMapConfig file, have you included your
ErrorMap.xml (or whatever it's called) BEFORE the SqlMap which is trying
to use it?

I've seen problems caused by this in the past.


Alistair.

-----Original Message-----
From: _Eric_ [mailto:eric_@web.de] 
Sent: 15 January 2009 12:44
To: user-java@ibatis.apache.org
Subject: include SQL mapping file


Hi all,

I have one mapping file for every message type I send. There is an error
handling used in every message type. So I want to put it in an seperate
mapping config:

<sqlMap namespace="Error">
	<typeAlias alias="Error" type="de.blah.database.type.ZdaError"
/>
	<resultMap id="ErrorMap" class="Error" >
	        <result property="code" column="code" />
 		<result property="message" column="message" />
 	</resultMap>

  	<select id="getError" parameterClass="int" resultMap="ErrorMap"
>
 		SELECT code, message FROM error WHERE id=#value#
	</select>
</sqlMap>


To use it I used the select with the name space :<result
property="error" 
column="error" select="Error.getError"/> And put the sqlMap resource
into the sqlMapConfig.

The result is an iBatis error: Cause:
com.ibatis.sqlmap.client.SqlMapException: There is no statement named
Error.getError in this SqlMap.

How can I reuse in sveral mapping files?

Greetings
Eric


--
View this message in context:
http://www.nabble.com/include-SQL-mapping-file-tp21476828p21476828.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.



Please help Logica to respect the environment by not printing this email  /  Merci d'aider Logica � pr�server l'environnement en �vitant d'imprimer ce mail /  Bitte drucken Sie diese Nachricht nicht aus und helfen Sie so Logica dabei die Umwelt zu schuetzen  /  Por favor ajude a Logica a respeitar o ambiente n�o imprimindo este correio electr�nico.



This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.