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]