OK, I used getReportQueryIteratorByQuery() and it works.

Thanks,

Rob

-----Original Message-----
From: Armin Waibel [mailto:[EMAIL PROTECTED] 
Sent: 18 September 2007 14:07
To: OJB Users List
Subject: Re: getPKEnumerationByQuery()

Hi Robert,

Robert Giddings wrote:
> Hi,
> 
> When using the method getPKEnumerationByQuery() I get the following
> error:
> 
> 
> Caused by: java.util.NoSuchElementException
>         at
> org.apache.ojb.broker.accesslayer.PkEnumeration.nextElement(Unknown S
> ource)
>         at
> com.netcase.database.DAOService.getIdsByPropertyMatch(DAOService.java
> :117)
> 
> Has anyone else had any problems using OJB's Enumeration
implementation?
> As the code that iterates through it is this:
> 
> Enumeration pks = broker.getPKEnumerationByQuery(PrimaryKey.class,
> query);
>                       Collection<Integer> ids = new
> ArrayList<Integer>();
>                       while(pks.hasMoreElements()) {
>                               PrimaryKey pk =
> (PrimaryKey)pks.nextElement();
>                               ids.add(pk.getId());
>                       }
> 
> And I can't see any problem with this code, and so can only conclude
> that the hasMoreElements() or nextElement() method was not implemented
> correctly.

Please check OJB's logging output. Any error log before the 
NoSuchElementException?

By the way, this class is now deprecated because nobody seems to use it.

If you need the PK values to create a user specific PrimaryKey class I 
would recommend (for best performance) a report query to get all PK's.

regards,
Armin

> 
> Thanks,
> 
> Robert Giddings
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-- 
No virus found in this incoming message.
Checked by AVG Free Edition. 
Version: 7.5.487 / Virus Database: 269.13.22/1013 - Release Date:
17/09/2007 13:29



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to