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
>
>
>