Hello,
sorry if this question has been asked annywhere, couldnt find it in the
archive.. 
 
Any ideas about why i get the error?
 
public Collection listCountrys(User user) throws BusinessException {
        PersistenceBroker broker = null;
        
        try {
            broker =
PersistenceBrokerFactory.defaultPersistenceBroker();
        } catch(PBFactoryException dae) {
            throw new BusinessException("Could not get
persistancebroker", dae);
        }
        
        try {
            Criteria crit = new Criteria();
            crit.addOrderByAscending("name");
            Query query = new QueryByCriteria(CountryImpl.class, crit);
            
            return broker.getCollectionByQuery(query);
        } catch(Throwable t) {
            throw new BusinessException("Could not list countrys", t);
        } finally {
            broker.close();
        }
    }
 
javax.servlet.ServletException: Could not list countrys
.....
Caused by: java.util.NoSuchElementException
at org.apache.ojb.broker.accesslayer.RsIterator.next(Unknown Source)
at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuer
y(Unknown Source)

repository_user.xml:
<class-descriptor class="<client-hidden>.dto.CountryImpl"
table="TM.COUNTRY">
  <field-descriptor id="0" name="countryId" column="COUNTRY_ID"
jdbc-type="BIGINT" primarykey="true" autoincrement="true"/>
  <field-descriptor id="2" name="currencyId" column="CURRENCY_ID"
jdbc-type="BIGINT"/>
  <field-descriptor id="1" name="name" column="NAME"
jdbc-type="VARCHAR"/>
  <reference-descriptor name="currency"
class-ref="<client-hidden>.dto.CurrencyImpl" auto-retrieve="true"
auto-update="false" auto-delete="false">
   <foreignkey field-id-ref="2"/>
  </reference-descriptor>
 </class-descriptor>

 <class-descriptor class="<client-hidden>.dto.CurrencyImpl"
table="TM.CURRENCY">
  <field-descriptor id="0" name="currencyId" column="CURRENCY_ID"
jdbc-type="BIGINT" primarykey="true" autoincrement="true"/>
  <field-descriptor id="1" name="name" column="NAME"
jdbc-type="VARCHAR"/>
  <collection-descriptor name="countrys"
element-class-ref="<client-hidden>.dto.CountryImpl" auto-retrieve="true"
auto-update="false" auto-delete="false">
   <inverse-foreignkey field-id-ref="2"/>
  </collection-descriptor>
 </class-descriptor>
 

Reply via email to