Hi All,
I got a problem when tried to map a hierarchy using the "one table per hierarchy" strategy.
I have an abstract superclass, named A, and 3 subclasses, B, C, and D.
The problem is that I programmed B, C, and D, as private static classes of the superclass A. Something like this:
public class A
{
int oid;
String name;
public A(String name)
{
this.nome = nome;
}
...
private static class B extends A()
{
public B()
{
super("B");
}
}
...
}
My intention is to use attribute "name" as a discriminator. But it is not working.
The descriptor mapping for class A is the following:
<class name="A" table="tb_a">
<id name="oid" type="int" column="id" unsaved-value="0">
<generator class="identity"/>
</id>
<discriminator column="name" type="string"/>
<property name="nome">
<column name="nome" sql-type="varchar(32)" not-null="true"/>
</property>
<subclass name="A$B" discriminator-value="b">
</subclass>
...
</class>
Is it correct ?
How could I implement that mapping strategy for this implementation ?
Thanks in adv
Gustavo
|