Thanks for the response. If I understand correctly there is no way we can map the abstract class to it's own table.
Thanks again for the response. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 8:52 AM To: OJB Users List Subject: Re: Inheritance Problem. Hello Ziv, In persisting the parent class OJB has to instantiate it (using log4j you see the exact position if you set the logging to "DEBUG" in theOJB.properties). Since this can't be done with an abstract class, the described error occurs. Working around the same error we decided to make the abstract class concrete and have a log entry in the constructor, so we can check it`s instantiations. Another way would be to map each implementation to a different table, thus treating the abstact class like an interface. Perhaps there should be a warning in tutorial 3 ("Advanced O/R") about this restriction. Regards, Birgitta Ziv Yankowitz wrote: Folks, we need to map an abstract class and it's implementation to two different tables we tried the following : > abstract class A { > > private id > private valueA > protected ojbConcreteClass > } > > class B extends A{ > > private id2 > private valueB > } > > the repository file: > > <class-descriptor > class="A" > table="A_TABLE"> > > > <field-descriptor > name="id" > column="ID" > jdbc-type="INTEGER" > primarykey="true" > autoincrement="true" > /> > <field-descriptor > name="valueA" > column="VALUE" > jdbc-type="INTEGER" > /> > > </class-descriptor> > > <class-descriptor > class="B" > table="B_TABLE" > > > > <field-descriptor > name="id2" > column="ID" > jdbc-type="INTEGER" > primarykey="true" > autoincrement="true" > /> > > > <field-descriptor > name="valueB" > column="VALUE" > jdbc-type="INTEGER" > /> > > <field-descriptor> > name="ojbConcreteClass"> > column="CLASS_NAME"> > jdbc-type="VARCHAR"> > /> > > <reference-descriptor name="super" > class-ref="A" auto-update="true"> > <foreignkey field-ref="id2"/> > </reference-descriptor> > > </class-descriptor> > we encounter in the following error: org.apache.ojb.broker.PersistenceBrokerException: org.apache.ojb.broker.metadata.MetadataException: java.lang.Instantiat ionException what are we doing wrong ? --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
