I was able to "work-around" this problem by doing the following:

We have a table - user_sys_access, where the primary key is the combination
of userid, mso_id, and headend_id.  There can be multiple rows so that you
might end up with something like the following:

userid  mso_id          headend_id
------  -------         ----------
tomcat  1                       3
tomcat  2                       2

The mso's and headend's are used to control a user's access.  I didn't
design the database, so I don't want to go there ;)

What I do want to do is to query the user table and get all the user's
mso_ids.  Using the query below, it didn't work.  So I added another query,
and this works:

String qry = "from cct_user in class
com.cable.comcast.dmc.itd.cct.persistence.User where cct_user.userId=?";
List users = (List) ses.find(qry, userId, Hibernate.STRING);

List msoList = (List) ses.find("select distinct cct_user.msoId " + qry,
userId, Hibernate.STRING);

If there's a better way, please let me know as this seems like kindof a
kludge.

Matt


-----Original Message-----
From: Konstantin Priblouda [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 31, 2002 9:49 AM
To: Raible, Matt
Cc: hibernate-devel
Subject: Re: [Hibernate] List only returns first row, rather than both



--- "Raible, Matt" <[EMAIL PROTECTED]>
wrote:
> I have to rows in my "user" table and I expect to
> get two rows of data back.
> However, the following query returns two items in
> the list, but they're the
> same:
> 
> List users = (List) ses.find("from cct_user in class
> com.cable.comcast.dmc.itd.cct.persistence.User where
> cct_user.userId=?",
> userId, Hibernate.STRING);
> 
> Is this because userId is the named in User.hbm.xml
> as the primary key?  I
> tried to create a composite-id element, which is
> what it is in the database,
> but XDoclet doesn't seem to let me.  I added two
> @hibernate.id tags to two
> different getters, but that just generated two
> different id elements in my
> xml mapping file.

Matt, file issue in JIRA and assign it to me
( or it will be lost )
I will look at it.

regards,

=====
Konstantin Priblouda ( ko5tik )    Freelance Software developer
< http://www.pribluda.de > < play java games -> http://www.yook.de >
< render charts online -> http://www.pribluda.de/povray/ >

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to