ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Klaene <mkla...@yahoo.com>
Subject Re: SQL Map problem when map keyed on attribute not in object
Date Tue, 08 Feb 2005 21:25:49 GMT
Yes.  I'm using queryForMap.  I want the map to return a Map of userRoles but keyed on an attribute
not in that object.   I don't suppose its possible to create a hybrid resultMap specifying
2 seperate domain objects (class="org.jsurveys.domain.UserRole,org.jsurveys.domain.Role">)?
 
Mike

Brandon Goodin <brandon.goodin@gmail.com> wrote:
oops, I misunderstood. You should look at queryForMap.

Brandon


On Tue, 8 Feb 2005 12:53:03 -0700, Brandon Goodin

wrote:
> why don't you simply create another resultMap or set resultClass to HashMap?
> 
> Brandon
> 
> 
> On Tue, 8 Feb 2005 10:52:26 -0800 (PST), Michael Klaene
> wrote:
> > I have 2 tables, user and role, and an associate table user_role which, as
> > you would expect contains user_role_id,user_id, and role_id keys. I want to
> > read the following query into a map of userRole objects that will be keyed
> > on role name (from the Role object):
> >
> > 
> > SELECT role.name, user_role.user_role_id,user_role.user_id,
> > user_role.role_id, user_role.default_role,
> > user_role.status,user_role.created_on,user_role.created_by,
> > user_role.updated_on, user_role.updated_by
> > FROM role, user_role
> > WHERE user_role.user_id = #value#
> > AND user_role.role_id = role.role_id
> > 
> >
> > And I'm currently trying to do this using the following result map, which
> > mirrors the userRole object:
> >
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> >
> > Obviously it doesn't work as name is not an attribute of userRole and I'd
> > rather not add it to the object for just this task. Is there another way I
> > might accomplish this via a SQL Map (ie without extra Java code to build the
> > map after the sql map call)?
> >
> > Thanks,
> > Mike
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam? Yahoo! Mail has the best spam protection around
> > http://mail.yahoo.com
>

		
---------------------------------
Do you Yahoo!?
 Meet the all-new My Yahoo!  Try it today! 
Mime
View raw message