You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-cs@ibatis.apache.org by Nic Smith <ns...@boardbooks.com> on 2007/07/19 04:43:33 UTC
Passing a custom class type + additional data
Hi,
Is it possible to pass in user defined types as well as additional data
types in a Map. For example:
------
<select id="SelectDocument" parameterClass="map"
resultMap="DocumentResult">
I want the map to contain a type of "Document" (a class in our .Net
code), as well as an int[].
So, the key value pairs would be:
document, {object type of Document}
groups, {int[]}
Can I then in my SQL statement write something like this?
UPDATE
[DocumentTable]
SET
Id = #document.Id#,
Name = #document.ShortName#
WHERE
GroupId IN
<iterate property=" groups" open="(" close=")" conjunction=",">
# groups[]#
</iterate>
If this isn't the case? Is there some other way that I can do this?
Cheers,
Nic
Re: Passing a custom class type + additional data
Posted by Peter Mills <de...@peter.mills.to>.
Hi Nic,
Try using a parameter map. I hope that using parameterClass="map" with
dot notation works everywhere, but when I looked through my code, I
realized that I've only used used them together in parameter maps (for
calling stored procedures). I hope this works for you, in the chance
that the dot notation doesn't work with inline parameters.
Cheers,
Peter
Nic Smith wrote:
> Has anyone actually managed to get this working? It doesn’t looking
> like iBatis supports the ‘dot notation’. So while you can pass through
> custom classes in a map you can’t then access any of its properties.
> Is there anything I may have missed here?
>
> Cheers,
>
> Nic
>
> *From:* Tony Johnson [mailto:listAccount@deepcode.co.uk]
> *Sent:* Thursday, 19 July 2007 8:59 p.m.
> *To:* user-cs@ibatis.apache.org
> *Subject:* RE: Passing a custom class type + additional data
>
> Yeah, you should certainly be able to do that…
>
> ------------------------------------------------------------------------
>
> *From:* Nic Smith [mailto:nsmith@boardbooks.com]
> *Sent:* 19 July 2007 03:44
> *To:* user-cs@ibatis.apache.org
> *Subject:* Passing a custom class type + additional data
>
> Hi,
>
> Is it possible to pass in user defined types as well as additional
> data types in a Map. For example:
>
> ------
>
> <select id="SelectDocument" parameterClass="map"
> resultMap="DocumentResult">
>
> I want the map to contain a type of “Document” (a class in our .Net
> code), as well as an int[].
>
> So, the key value pairs would be:
>
> document, {object type of Document}
>
> groups, {int[]}
>
> Can I then in my SQL statement write something like this?
>
> UPDATE
>
> [DocumentTable]
>
> SET
>
> Id = #document.Id#,
>
> Name = #document.ShortName#
>
> WHERE
>
> GroupId IN
>
> <iterate property=" groups" open="(" close=")" conjunction=",">
>
> # groups[]#
>
> </iterate>
>
> If this isn’t the case? Is there some other way that I can do this?
>
> Cheers,
> Nic
>
Re: Passing a custom class type + additional data
Posted by Michael Schall <mi...@gmail.com>.
We do this all the time. What is the error you are getting?
On 7/19/07, Nic Smith <ns...@boardbooks.com> wrote:
>
> Has anyone actually managed to get this working? It doesn't looking like
> iBatis supports the 'dot notation'. So while you can pass through custom
> classes in a map you can't then access any of its properties. Is there
> anything I may have missed here?
>
>
>
> Cheers,
>
> Nic
>
>
>
> *From:* Tony Johnson [mailto:listAccount@deepcode.co.uk]
> *Sent:* Thursday, 19 July 2007 8:59 p.m.
> *To:* user-cs@ibatis.apache.org
> *Subject:* RE: Passing a custom class type + additional data
>
>
>
> Yeah, you should certainly be able to do that…
>
>
>
>
> ------------------------------
>
> *From:* Nic Smith [mailto:nsmith@boardbooks.com]
> *Sent:* 19 July 2007 03:44
> *To:* user-cs@ibatis.apache.org
> *Subject:* Passing a custom class type + additional data
>
>
>
> Hi,
>
>
>
> Is it possible to pass in user defined types as well as additional data
> types in a Map. For example:
>
>
>
> ------
>
> <select id="SelectDocument" parameterClass="map"
> resultMap="DocumentResult">
>
>
>
> I want the map to contain a type of "Document" (a class in our .Net code),
> as well as an int[].
>
>
>
> So, the key value pairs would be:
>
> document, {object type of Document}
>
> groups, {int[]}
>
>
>
> Can I then in my SQL statement write something like this?
>
> UPDATE
>
> [DocumentTable]
>
> SET
>
> Id = #document.Id#,
>
> Name = #document.ShortName#
>
> WHERE
>
> GroupId IN
>
> <iterate property=" groups" open="(" close=")" conjunction=",">
>
> # groups[]#
>
> </iterate>
>
>
>
> If this isn't the case? Is there some other way that I can do this?
>
>
>
> Cheers,
> Nic
>
RE: Passing a custom class type + additional data
Posted by Nic Smith <ns...@boardbooks.com>.
Has anyone actually managed to get this working? It doesn't looking like
iBatis supports the 'dot notation'. So while you can pass through custom
classes in a map you can't then access any of its properties. Is there
anything I may have missed here?
Cheers,
Nic
From: Tony Johnson [mailto:listAccount@deepcode.co.uk]
Sent: Thursday, 19 July 2007 8:59 p.m.
To: user-cs@ibatis.apache.org
Subject: RE: Passing a custom class type + additional data
Yeah, you should certainly be able to do that...
________________________________
From: Nic Smith [mailto:nsmith@boardbooks.com]
Sent: 19 July 2007 03:44
To: user-cs@ibatis.apache.org
Subject: Passing a custom class type + additional data
Hi,
Is it possible to pass in user defined types as well as additional data
types in a Map. For example:
------
<select id="SelectDocument" parameterClass="map"
resultMap="DocumentResult">
I want the map to contain a type of "Document" (a class in our .Net
code), as well as an int[].
So, the key value pairs would be:
document, {object type of Document}
groups, {int[]}
Can I then in my SQL statement write something like this?
UPDATE
[DocumentTable]
SET
Id = #document.Id#,
Name = #document.ShortName#
WHERE
GroupId IN
<iterate property=" groups" open="(" close=")" conjunction=",">
# groups[]#
</iterate>
If this isn't the case? Is there some other way that I can do this?
Cheers,
Nic
RE: Passing a custom class type + additional data
Posted by Tony Johnson <li...@deepcode.co.uk>.
Yeah, you should certainly be able to do that.
_____
From: Nic Smith [mailto:nsmith@boardbooks.com]
Sent: 19 July 2007 03:44
To: user-cs@ibatis.apache.org
Subject: Passing a custom class type + additional data
Hi,
Is it possible to pass in user defined types as well as additional data
types in a Map. For example:
------
<select id="SelectDocument" parameterClass="map" resultMap="DocumentResult">
I want the map to contain a type of "Document" (a class in our .Net code),
as well as an int[].
So, the key value pairs would be:
document, {object type of Document}
groups, {int[]}
Can I then in my SQL statement write something like this?
UPDATE
[DocumentTable]
SET
Id = #document.Id#,
Name = #document.ShortName#
WHERE
GroupId IN
<iterate property=" groups" open="(" close=")" conjunction=",">
# groups[]#
</iterate>
If this isn't the case? Is there some other way that I can do this?
Cheers,
Nic