You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Christian Eugster <ch...@bluewin.ch> on 2003/04/08 22:09:22 UTC
java.lang.Integer not found in OJB Repository
Hi,
i am trying (as a newby) to insert a record into a table and get the
following exception:
org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException:
java.lang.Integer not found in OJB Repository
at
org.apache.ojb.broker.metadata.DescriptorRepository.getDescriptorFor(Unknown
Source)
at
org.apache.ojb.broker.metadata.DescriptorRepository.getDescriptorFor(Unknown
Source)
at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.assertFkAssignment(Unkn
own Source)
at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.assignReferenceFKs(Unkn
own Source)
at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.storeToDb(Unknown
Source)
at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.store(Unknown
Source)
at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.store(Unknown
Source)
at org.apache.ojb.broker.singlevm.DelegatingPersistenceBroker.store(Unknown
Source)
the table consists of the following fields (class Tax):
public interface ITax {
public abstract void setId(int id);
public abstract int getId();
public abstract void setCurrentTaxId(int currentTaxId);
public abstract int getCurrentTaxId();
public abstract void setAccount(String account);
public abstract String getAccount();
public abstract void setTaxTypeId(int taxType);
public abstract int getTaxTypeId();
public abstract void setTaxRateId(int taxRate);
public abstract int getTaxRateId();
}
and the table in the database ist defined as follows:
<class-descriptor
class="ch.eugster.pos.data.Tax"
table="POS_TAX"
>
<field-descriptor
name="id"
column="ID"
jdbc-type="INTEGER"
primarykey="true"
autoincrement="true"
/>
<field-descriptor
name="currentTaxId"
column="CURRENTTAX_ID"
jdbc-type="INTEGER"
/>
<field-descriptor
name="taxTypeId"
column="TAXTYPE_ID"
jdbc-type="INTEGER"
/>
<field-descriptor
name="taxRateId"
column="TAXRATE_ID"
jdbc-type="INTEGER"
/>
<field-descriptor
name="account"
column="ACCOUNT"
jdbc-type="VARCHAR"
length="20"
/>
<reference-descriptor
name="id"
class-ref="ch.eugster.pos.data.CurrentTax"
>
<foreignkey field-ref="currentTaxId"/>
</reference-descriptor>
<collection-descriptor
name="currentTaxList"
element-class-ref="ch.eugster.pos.data.CurrentTax"
orderby="id"
sort="ASC"
>
<inverse-foreignkey field-ref="taxId"/>
</collection-descriptor>
</class-descriptor>
can anybody tell me, what I am doing wrong?
Thank you!
Christian
RE: java.lang.Integer not found in OJB Repository
Posted by Vincenz Braun <vb...@evelox.de>.
The problem is here: The reference descriptor must point to
the field that holds the ch.eugster.pos.data.CurrentTax. But
id is an int. You need a
protected CurrentTax currentTax;
and a descriptor that looks like:
<reference-descriptor
name="currentTax"
class-ref="ch.eugster.pos.data.CurrentTax"
>
<foreignkey field-ref="currentTaxId"/>
</reference-descriptor>
instead of:
<reference-descriptor
name="id"
class-ref="ch.eugster.pos.data.CurrentTax"
>
<foreignkey field-ref="currentTaxId"/>
</reference-descriptor>