|
List Info
Thread: TypeHandler for Xml data type in Sql Server
|
|
| TypeHandler for Xml data type in Sql
Server |

|
2008-01-14 08:47:26 |
|
Hi
I was wondering if any one could provide
any pointers on how I might map an SqlServer Xml data type using Ibatis.
I am using the following: -
CREATE TABLE [dbo].[Reports](
[ID] [int] IDENTITY(1,1)
NOT NULL,
[Config] [xml] NOT NULL
) ON [PRIMARY]
Part of my sqlMap is as follows: -
…
<resultMaps>
<resultMap id="SelectResult" class="Report">
<result property="Id" column="ID"/>
<result property="Config" column="Config" />
</resultMap>
</resultMaps>
<statements>
<select id="GetReport" parameterClass="int" resultMap="SelectResult">select
* from dbo.Reports where ID = #Id#</select>
<select id="GetReportList" parameterClass="int" resultMap="SelectResult">select
* from dbo.Reports</select>
…
</statements>
…
I
was planning on my object along the lines of: -
public
class report {
…
public
SqlXml Config { .. }
}
But
I suspect I need to somehow deal with a Binary stream.
Any
help would be greatly appreciated.
Thanks
in advance
Blair
|
| Re: TypeHandler for Xml data type in Sql
Server |

|
2008-01-14 12:21:33 |
|
There's a unit test showing how to use an XML input parameter, search in SVN a unit test named TestXMLParameter using the store procedure SelectAccountViaXML and have a look for inspiration.
Here9;s a Java XML TypeHandler
http://opensource.atlassian.com/confluence/oss/display/IBATIS/Type+Handler+Callbacks
-- Cheers,
Gilles
|
[1-2]
|
|
|
about | contact Other archives ( Real Estate discussion Medical topics )
|