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