getPKEnumerationByQuery()

"Robert Giddings" <[email protected]> Tue, 18 Sep 2007 10:43:45 +0100
Newsgroups gmane.comp.jakarta.ojb.user
Message-ID <000401c7f9d8$683d79e0$0600a8c0@zaphod>
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.

Thanks,

Robert Giddings