I keep getting NullPointerExceptions while retrieving an object from the database (OJB 1.0RC4).
my repository_user.xml is set up as explained in the tutorials (extent-class in Template/BaseTemplate etc., to be sure I also used ojbConcreteClass to specify the classname)
Please post the repository_user.xml. I guess an attribute or field-descriptor is missing there.
NB: I use the xdoclet module to generate the mappings:
<class-descriptor class="cabane.templates.Template" table="TEMPLATES" > <extent-class class-ref="cabane.templates.BaseTemplate"/> <extent-class class-ref="cabane.templates.MailTemplate"/> </class-descriptor>
<class-descriptor class="cabane.templates.BaseTemplate" proxy="dynamic" > <extent-class class-ref="cabane.templates.MailTemplate"/> </class-descriptor>
<class-descriptor class="cabane.templates.MailTemplate" table="TEMPLATES" > <field-descriptor name="id" column="ID" jdbc-type="INTEGER" primarykey="true" autoincrement="true" > </field-descriptor> <field-descriptor name="name" column="NAME" jdbc-type="VARCHAR" > </field-descriptor> <field-descriptor name="language" column="LANGUAGE" jdbc-type="VARCHAR" > </field-descriptor> <field-descriptor name="content" column="CONTENT" jdbc-type="VARCHAR" > </field-descriptor> </class-descriptor>
Another valuable hint could be a stacktrace with linetest:
numbers.
[junit] Testsuite: cabane.templates.TemplateTest
[junit] Tests run: 1, Failures: 1, Errors: 0, Time elapsed: 3,119 sec
[junit] ------------- Standard Error -----------------
[junit] java.lang.NullPointerException
[junit] at org.apache.ojb.broker.metadata.ClassDescriptor.getPkFields(Cl assDescriptor.java:893)
[junit] at org.apache.ojb.broker.accesslayer.RsIterator.getIdentityFromR esultSet(RsIterator.java:378)
[junit] at org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromRes ultSet(RsIterator.java:424)
[junit] at org.apache.ojb.broker.accesslayer.RsIterator.next(RsIterator. java:254)
[junit] at org.apache.ojb.broker.accesslayer.ChainingIterator.next(Chain ingIterator.java:357)
[junit] at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectio nByQuery(PersistenceBrokerImpl.java:1374)
[junit] at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectio nByQuery(PersistenceBrokerImpl.java:1515)
[junit] at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectio nByQuery(PersistenceBrokerImpl.java:1551)
[junit] at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectio nByQuery(PersistenceBrokerImpl.java:1540)
[junit] at org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQ uery(PersistenceBrokerImpl.java:1802)
[junit] at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObj ectByQuery(DelegatingPersistenceBroker.java:286)
[junit] at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObj ectByQuery(DelegatingPersistenceBroker.java:286)
[junit] at cabane.persistence.OJBPersistence.getTemplate(OJBPersistence. java:246)
reagarding the "skipped" message I think you're right, it only occurred when I put the field descriptors in the base _and_ extended class.
regards, Jan
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]