ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brandon Goodin <brandon.goo...@gmail.com>
Subject Re: queryForMap from resultMap
Date Thu, 17 Feb 2005 19:02:08 GMT
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 <amad.fida@gmail.com> 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 <amad.fida@gmail.com> 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
> >>
> >>
> >>
> >>
> >>
> >
> >
> >
> 
> 
>

Mime
View raw message