Yes, Strings are immutable, but Map entries are not. Remember, it's the parameter class that matters. If you passed a String as the parameter class, it wouldn't be able to receive an output value.
Cheers, Clinton On Thu, 17 Feb 2005 23:28:26 -0000, Yee, Richard K, CTR,, DMDCWEST <[EMAIL PROTECTED]> wrote: > I'm a little confused about INOUT parameters for stored procedures. The > iBATIS-SqlMaps.pdf documentation says the following: > <snip> > Stored Procedures > Stored procedures are supported via the <procedure> statement element. The > following example shows > how a stored procedure would be used with output parameters. > <parameterMap id="swapParameters" class="map" > > <parameter property="email1" jdbcType="VARCHAR" javaType="java.lang.String" > mode="INOUT"/> > <parameter property="email2" jdbcType="VARCHAR" javaType="java.lang.String" > mode="INOUT"/> > </parameterMap> > <procedure id="swapEmailAddresses" parameterMap="swapParameters" > > {call swap_email_address (?, ?)} > </procedure> > Calling the above procedure would swap two email addresses between two > columns (database table) and also in the parameter object (Map). The > parameter object is only modified if the parameter mappings mode attribute > is set to "INOUT" or "OUT". Otherwise they are left unchanged. Obviously > immutable parameter objects (e.g. String) cannot be modified. > </snip> > > My question is about the last sentence, "Obviously immutable parameter > objects (e.g. String) cannot be modified." In the example given, aren't the > parameters Strings and aren't they modified by the stored procedure? > > Can anyone clear up my confusion? > > Thanks, > > Richard > > -----Original Message----- > From: Brandon Goodin [mailto:[EMAIL PROTECTED] > Sent: Thursday, February 17, 2005 11:02 AM > To: ibatis-user-java@incubator.apache.org > Subject: Re: queryForMap from resultMap > > It's not possible to perform a queryForMap from the complex property. > > Also, do you realize that the complex property query will not reduce the > number of hits on your database. So, I would suggest that you query your > accounts first and then iterate through the list using the queryForMap. It's > a little more java code. But, there is not benefit to doing the complex > query in ibatis anyways. > > Also, if you are returning copious amounts of data you might conisder paging > it. If you use the PaginatedList it will only retrieve the records you need > for the current page. So, you will not be selecting the full 50,000 records > along with 50,000 individual queries on your database. > > Remember that the PaginatedList must be persisted in your session scope. > > Brandon > > On Thu, 17 Feb 2005 10:45:06 -0800, Anad Fida <[EMAIL PROTECTED]> wrote: > > >>How to queryForMap using the resultMap complex properties > > >>functionality. > > > > I need to know how do I use queryForMap using resultMap complex > > properties functionality but for this map, I should be able to define > > which column to use as key and which to use as value. > > > > Amad > > > > > > Brandon Goodin wrote: > > > > >I am not sure which issue your asking for help on... > > > > > >How to reduce the number of queries. > > > > > >-- or -- > > > > > >How to queryForMap using the resultMap complex properties > > >functionality. > > > > > >Could you please clarify what you are asking. > > > > > >Brandon > > > > > >On Thu, 17 Feb 2005 03:05:56 -0800, Anad Fida <[EMAIL PROTECTED]> > > >wrote: > > > > > > > > >>I have a Domain Object as following, > > >> > > >>public class Account { > > >> > > >> private long accountKey; > > >> private String accountName; > > >> private String userName; > > >> private Date lastUpdateDate; > > >> > > >> // Holds account attribute name - values > > >> private Map accountAttributes; > > >> > > >>// Setters/Getters........ > > >>} > > >> > > >>I have accounts, attributes, account_attributes tables, you know the > > >>usual relationships. My problem is in order to get the Account and > > >>for each account, I need to get its attribute map. > > >> > > >>One option is to get all the accounts and then for each account i > > >>get its attributes as name, value pair using "queryForMap("queryID", > > >>account.getKey(), "Name", "Value"). But I have around 50, 000 > > >>accounts and for each account I have to run this extra query so > > >>could end up running 50, 001 queries. > > >> > > >>I was hoping that I could use this queryForMap from accounts > > >>resultMap as <resultMap id="getAccounts"> ..... > > >><result property="accountAttributes" column="accountKey" > > >>select="getAccountAttributeMap">, > > >>.... > > >></resultMap> > > >> > > >>but i want to specify the property for key and property for value, > > >>for this "getAccountAttributeMap". I am not sure how to do that from > > >>SqlMap? > > >> > > >>Any help would be really appreciated. > > >> > > >>Amad > > >> > > >> > > >> > > >> > > >> > > > > > > > > > > > > > > > >