I had similar odd problems with lists when my indexes were wrong.  Check
to be sure they are continuous, unique, and start at 0.  Hibernate will
maintain them properly, but they're easy to mangle if you're doing
updates by hand.

Jeff Schnitzer
[EMAIL PROTECTED]

> -----Original Message-----
> From: Raible, Matt [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, January 14, 2003 11:33 AM
> To: '[EMAIL PROTECTED]'
> Subject: [Hibernate] Query only brings back first record
> 
> I have the following hibernate code that queries a table and brings
back
> rows.  Hibernate brings back the proper number of rows (3), but each
> object
> (row) is identical - the first one.
> 
>       StringBuffer query = new StringBuffer();
>       query.append("from cr in class
> com.comcast.cable.dmc.itd.cct.persistence.ChangeRequestDetail ");
>       query.append("where (cr.msoId=? and cr.headendId=?) ");
>       query.append("or (cr.msoId=0) or (cr.headendId=0) ");
>       query.append("order by cr.msoName");
>       ses = HibernateSession.currentSession();
> 
>       // create arrays of variables to bind and types
>       Object[] vars = new Object[] { msoId, headendId };
>       Type[] types = new Type[] { Hibernate.LONG, Hibernate.LONG };
> 
>       crList = (List) ses.find(query.toString(), vars, types);
> 
> 
> 
> When I run this query in Oracle's sqlplus, I get 3 unique rows:
> 
> MSO_DESC                       HEADEND_NAME
FORM_DESC
> ------------------------------ ------------------------------
> ----------------
> AT&T                           AMERICAN CANYON, CA            HSCRF
> AT&T                           AMERICAN CANYON, CA            CMCF
> AT&T                           AMERICAN CANYON, CA            CMCF
> 
> 
> Here's the identical objects from my test:
> 
>     [junit] DEBUG [main]
> ChangeRequestDAOHibernateTest.testGetChangeRequests(81) |
> [com.comcast.cabl
> e.dmc.itd.cct.persistence.ChangeRequestDetail
>     [junit]     msoName=AT&T
>     [junit]     headendName=AMERICAN CANYON, CA
>     [junit]     crStatusId=160
>     [junit]     crStatus=Warning
>     [junit]     formId=700
>     [junit]     formName=HSCRF
>     [junit]     sheetId=800
>     [junit]     sheetName=HSCRF_SIGNAL
>     [junit]     statusId=160
>     [junit]     status=Warning
>     [junit] ,
> com.comcast.cable.dmc.itd.cct.persistence.ChangeRequestDetail
>     [junit]     msoName=AT&T
>     [junit]     headendName=AMERICAN CANYON, CA
>     [junit]     crStatusId=160
>     [junit]     crStatus=Warning
>     [junit]     formId=700
>     [junit]     formName=HSCRF
>     [junit]     sheetId=800
>     [junit]     sheetName=HSCRF_SIGNAL
>     [junit]     statusId=160
>     [junit]     status=Warning
>     [junit] ,
> com.comcast.cable.dmc.itd.cct.persistence.ChangeRequestDetail
>     [junit]     msoName=AT&T
>     [junit]     headendName=AMERICAN CANYON, CA
>     [junit]     crStatusId=160
>     [junit]     crStatus=Warning
>     [junit]     formId=700
>     [junit]     formName=HSCRF
>     [junit]     sheetId=800
>     [junit]     sheetName=HSCRF_SIGNAL
>     [junit]     statusId=160
>     [junit]     status=Warning
>     [junit] ]
> 
> Thanks,
> 
> Matt
> 
> 
> 
> -------------------------------------------------------
> This SF.NET email is sponsored by: Take your first step towards giving
> your online business a competitive advantage. Test-drive a Thawte SSL
> certificate - our easy online guide will show you how. Click here to
get
> started: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0027en
> _______________________________________________
> hibernate-devel mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/hibernate-devel



-------------------------------------------------------
This SF.NET email is sponsored by: Take your first step towards giving
your online business a competitive advantage. Test-drive a Thawte SSL
certificate - our easy online guide will show you how. Click here to get
started: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0027en
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to