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









begin:vcard
fn:Amad Fida
n:Fida;Amad
email;internet:[EMAIL PROTECTED]
x-mozilla-html:TRUE
version:2.1
end:vcard

Reply via email to