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 Valentino Pinna <va...@virgilio.it> on 2004/09/26 19:24:13 UTC
JDO Inheritance problems
I have the following classes:
Utente { Integer codice; ...other fields... }
Profilo extends Utente {...other fields...}
I need to map them to two tables (PROFILO and UTENTE) without any redundance
(i.e. Profilo instances obtained from inner joins of PROFILO and UTENTE).
But even with a simple "Profilo.class" query, the following exception is
thrown:
java.lang.NullPointerException
at
org.apache.ojb.jdori.sql.OjbFieldManager.getValue(OjbFieldManager.java:269)
at
org.apache.ojb.jdori.sql.OjbFieldManager.fetchStringField(OjbFieldManager.ja
va:202)
at com.sun.jdori.common.state.StateManagerImpl.replacingStringField(Unknown
Source)
at app.model.Utente.jdoReplaceField(Utente.java)
at app.model.Profilo.jdoReplaceField(Profilo.java)
at app.model.Utente.jdoReplaceFields(Utente.java)
at com.sun.jdori.common.state.StateManagerImpl.replaceFields(Unknown
Source)
at
org.apache.ojb.jdori.sql.OjbExtent.provideStateManagers(OjbExtent.java:139)
at org.apache.ojb.jdori.sql.OjbExtent.<init>(OjbExtent.java:62)
at
org.apache.ojb.jdori.sql.OjbStoreManager.getExtent(OjbStoreManager.java:212)
at com.sun.jdori.common.PersistenceManagerImpl.getExtent(Unknown Source)
at com.sun.jdori.common.query.QueryImpl.checkCandidates(Unknown Source)
at com.sun.jdori.common.query.QueryImpl.execute(Unknown Source)
I tried this mapping but it doesn't work, please someone helps me!:
<class-descriptor class="app.model.Profilo" table="PROFILO" >
<field-descriptor
name="codice"
column="CODICE"
jdbc-type="INTEGER"
primarykey="true"
autoincrement="true"
sequence-name="UTENTE"
>
</field-descriptor>
..other descriptors...
<reference-descriptor name="super"
class-ref="app.model.Utente"
auto-retrieve="true"
auto-delete="true"
auto-update="true"
>
<foreignkey field-ref="codice" />
</reference-descriptor>
</class-descriptor>
<class-descriptor
class="app.model.Utente"
table="UTENTE"
>
<extent-class class-ref="app.model.Profilo" />
<field-descriptor
name="codice"
column="CODICE"
jdbc-type="INTEGER"
primarykey="true"
autoincrement="true"
sequence-name="UTENTE"
>
</field-descriptor>
...other descriptors...
</class-descriptor>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org