Hi,
is there any way to tell OJB to use a different attribute name for a
specific class instead of ojbConcreteClass?
The problem is, I have a table A with objects of two different classes
A und B (both using inheritance) instantiated from it.
Torque refuses the "datasql" target with the error:
Attribute "OjbConcreteClass" was already specified for element "ATABLE".
OJB itself is working fine with it.
Extracts from the classes and the repository.xml:
---------- snip ----------
/**
* @ojb.class table="ATABLE"
*/
public abstract class BaseA {
/**
* @ojb.field column="ID"
* jdbc-type="INTEGER" primarykey="true"
*/
protected int id;
/**
* @ojb.field column="A_CLASS_NAME"
* jdbc-type="VARCHAR" length="255" nullable="false"
*/
protected String ojbConcreteClass;
/**
* @ojb.field column="X_REF" jdbc-type="INTEGER"
*/
protected int xId;
/**
* @ojb.reference class-ref="org.xyz.X"
* foreignkey="xId"
*/
protected X x;
...
}
public class AImpl extends BaseA {
...
}
---------- snip ----------
/**
* @ojb.class table="ATABLE"
*/
public class BaseB {
/**
* @ojb.field column="ID"
* jdbc-type="INTEGER" primarykey="true"
*/
private Integer id;
/**
* @ojb.field column="B_CLASS_NAME"
* jdbc-type="VARCHAR" length="255" nullable="false"
*/
protected String ojbConcreteClass;
/**
* @ojb.field column="ANY_OTHER"
* jdbc-type="VARCHAR" length="50" nullable="false"
*/
protected String justGarbage;
...
}
public class BImpl extends BaseB {
...
}
---------- snip ----------
<class-descriptor
class="org.xyz.BaseA"
table="ATABLE"
>
<extent-class class-ref="org.xyz.AImpl"/>
<field-descriptor
name="id"
column="ID"
jdbc-type="INTEGER"
primarykey="true"
>
</field-descriptor>
<field-descriptor
name="ojbConcreteClass"
column="A_CLASS_NAME"
jdbc-type="VARCHAR"
nullable="false"
length="255"
>
</field-descriptor>
<field-descriptor
name="xId"
column="X_REF"
jdbc-type="INTEGER"
>
</field-descriptor>
<reference-descriptor
name="x"
class-ref="org.xyz.X"
>
<foreignkey field-ref="xId"/>
</reference-descriptor>
</class-descriptor>
<class-descriptor
class="org.xyz.AImpl"
table="ATABLE"
>
<field-descriptor
name="id"
column="ID"
jdbc-type="INTEGER"
primarykey="true"
>
</field-descriptor>
<field-descriptor
name="ojbConcreteClass"
column="A_CLASS_NAME"
jdbc-type="VARCHAR"
nullable="false"
length="255"
>
</field-descriptor>
<field-descriptor
name="xId"
column="X_REF"
jdbc-type="INTEGER"
>
</field-descriptor>
<reference-descriptor
name="x"
class-ref="org.xyz.X"
>
<foreignkey field-ref="xId"/>
</reference-descriptor>
</class-descriptor>
<class-descriptor
class="org.xyz.BaseB"
table="ATABLE"
>
<extent-class class-ref="org.xyz.BImpl"/>
<field-descriptor
name="id"
column="ID"
jdbc-type="INTEGER"
primarykey="true"
>
</field-descriptor>
<field-descriptor
name="ojbConcreteClass"
column="B_CLASS_NAME"
jdbc-type="VARCHAR"
nullable="false"
length="255"
>
</field-descriptor>
<field-descriptor
name="justGarbage"
column="ANY_OTHER"
jdbc-type="VARCHAR"
nullable="false"
length="50"
>
</field-descriptor>
</class-descriptor>
<class-descriptor
class="org.xyz.BImpl"
table="ATABLE"
>
<field-descriptor
name="id"
column="ID"
jdbc-type="INTEGER"
primarykey="true"
>
</field-descriptor>
<field-descriptor
name="ojbConcreteClass"
column="B_CLASS_NAME"
jdbc-type="VARCHAR"
nullable="false"
length="255"
>
</field-descriptor>
<field-descriptor
name="justGarbage"
column="ANY_OTHER"
jdbc-type="VARCHAR"
nullable="false"
length="50"
>
</field-descriptor>
</class-descriptor>
Bernd
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]