[EMAIL PROTECTED] wrote:
Hi Armin,
yes - I tried defining an extent and the appropriate class-descriptor's - I also experimented with "super". I assume that I am correct in assuming that it "is" possible to build such a structure with an abstract class?
yep, I wrote a test case (using "extent" and different tables, as described on my last post) on my local machine and it work without problems (store/delete graph of objects).
Pay attention not to mix different mapping strategy, e.g. use "extent" and "super" for the same classes, this could cause side-effects.
It should also be possible store the whole graph in one table using "ojbConcreteClass" feature.
regards, Armin
regards,
Marcus
Hi Marcus,
did you try to declare class-descriptor's for B and C (including all fields and references) and define an extent for class A:
<class-descriptor class="A"> <extent-class class-ref="B" /> <extent-class class-ref="C" /> </class-descriptor>
regards, Armin
Marcus Young wrote:
Hi,
I have just been working an issue related to mapping abstract classes. I've read quite a lot about it but I'm still unclear. The structure I have is as follows:
Abstract Class A which can hold a collection of 'A' objects. Classes B and C which extend A Each class is mapped to a separate table.
I am hoping to be able to retreive records in such a way as to 'build' an 'A' class object including the objects collection which may include objects of class B and C. So far I have been working with 'super' and 'extents' - but to be honest I'm not really sure how to get it working. Most commonly I'm getting exceptions of "InstantiationException". - this appears to be related to the abstract 'A' class? I can resolve this particular exception by using a concrete class, however I particularly wanted to use an abstract class. Any assistance would be greatly appreciated.
I end up with something like this:
public abstract class A extends TransferObject { protected Long _id; }
public class B extends A { private String _name; private String _description; *}
*public class C extends A { private String _name; private String _description; *}
* <class-descriptor
class="com.eclipsej.permission.A" table="A">
<field-descriptor
name="_id"
column="ID"
jdbc-type="BIGINT"
primarykey="true"
autoincrement="true"
/>
<!-- extent-class class-ref="com.eclipsej.user.B" / -->
</class-descriptor> <!-- Defnitions for com.eclipsej.user.B -->
<class-descriptor class="com.eclipsej.user.B" table="roles">
<field-descriptor name="_id" column="ID" jdbc-type="BIGINT" primarykey="true" autoincrement="true"/>
<field-descriptor name="_name" column="NAME" jdbc-type="VARCHAR"/>
<field-descriptor name="_description" column="DESCRIPTION" jdbc-type="VARCHAR"/> <reference-descriptor name="super" class-ref="com.eclipsej.permission.A"
auto-retreive="true" auto-update="true" auto-delete="true">
<foreignkey field-ref="_id"/>
</reference-descriptor> </class-descriptor>*
*
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Unix Systems Administrator
+61 3 9873 0155 +61 3 9720 7467 (fax)
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]