I'm reading and following the tutorial but I'm not able to define mapping files for inheritance.
This are my classes:
public class Author
private Vector <Album> allAlbum;
private String artName;
public class Artista extends Author
private String name;
private String surname;
public class Band extends Author
private Vector<String> components;
and this is the mapping file for Author:
<hibernate-mapping default-access="field" default-lazy="false"
default-cascade="save-update">
<class name="oodb.Author" table="author">
<id column="author_id" type="long">
<generator class="native"/>
</id>
<discriminator column="author_type" type="string"/>
<property name="artName"/>
<array name="allAlbum" table="album">
<key column="author_id"/>
<list-index column="sortOrder"/>
<one-to-many class="oodb.Album"/>
</array>
<subclass name="oodb.Band" extends="oodb.Author" discriminator-value="band">
<key column="author_id"/>
<array name="components" table="components">
<key column="author_id"/>
<list-index column="sortOrder"/>
<element column="component" type="string"/>
</array>
</subclass>
<subclass name="oodb.Artista" extends="oodb.Author" discriminator-value="solista">
<key column="author_id"/>
<property name="name" column="name"/>
<property name="surname" column="surname"/>
</subclass>
</class>
</hibernate-mapping>
I obtain the following error:
10:29:04,531 ERROR XMLHelper:61 - Error parsing XML: XML InputStream(31) The content of element type "subclass" must match "(meta*,tuplizer*,synchronize*,(property|many-to-one|one-to-one|component|dynamic-component|any|map|set|list|bag|idbag|array|primitive-array)*,join*,subclass*,loader?,sql-insert?,sql-update?,sql-delete?,resultset*,(query|sql-query)*)".
10:29:04,533 ERROR XMLHelper:61 - Error parsing XML: XML InputStream(40) The content of element type "subclass" must match "(meta*,tuplizer*,synchronize*,(property|many-to-one|one-to-one|component|dynamic-component|any|map|set|list|bag|idbag|array|primitive-array)*,join*,subclass*,loader?,sql-insert?,sql-update?,sql-delete?,resultset*,(query|sql-query)*)".
and I don't understand because I just follow what is written in the guide.
I'm sorry if it's a stupid question, I'm new to Hibernate and I searched on the net and tutorial, but didn't find much about this error.
If someone can help me or give me a reference for this I would be grateful.
thanks to all
|