Hibernate version: Hibernate 3.1.2
Hibernate-tools version: hibernate-tools-3.1.0.beta4
Hi List,
I'm experiencing a somewhat weird behaviour of hbm2java when mapping the following class hierarchy:
Code:
AbstractExampleEvent <-- ExampleEvent <-- ExampleSportsEvent
using the attached mapping.
The generated class for "ExampleSportsEvent" (using the meta "generated-class" tag) which is mapped as a subclass of "ExampleEvent" is generated with a ridiculous package name of:
Code:
ch.unartig.studioserver.model.GeneratedExampleEventch.unartig.studioserver.model.GeneratedExampleSportsEventch.unartig.studioserver.model
instead of just:
Code:
ch.unartig.studioserver.model
The problem only occurs for the sub-subclass mapping.
Creating (or renaming) the abstract classes manually everything seems to be fine with the posted mapping. Am I missing something?
Thanks a lot,
Alex
Mapping documents:Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class
name="ch.unartig.studioserver.model.AbstractExampleEvent"
table="AbstractExampleEvents"
>
<meta attribute="generated-class" inherit="false">ch.unartig.studioserver.model.GeneratedAbstractExampleEvent</meta>
<meta attribute="scope-class" inherit="false">public abstract</meta>
<cache usage="read-write"/>
<id
name="abstractExampleEventId"
type="java.lang.Long"
>
<meta attribute="use-in-tostring">true</meta>
<generator class="native">
<param name="sequence">sequence_abstractExampleEventId</param>
</generator>
</id>
<discriminator column="HIERARCHY_LEVEL" type="string"/>
<property
name="displayTitle"
type="java.lang.String"
length="255"
not-null="true"
>
<meta attribute="use-in-tostring">true</meta>
</property>
<!--first hierarchy level after abstract base event : Event-->
<subclass name="ch.unartig.studioserver.model.ExampleEvent">
<meta attribute="generated-class">ch.unartig.studioserver.model.GeneratedExampleEvent</meta>
<meta attribute="scope-class" inherit="false">public abstract</meta>
<!--second hierarchy level under ExampleEvent : SportsEvent-->
<subclass name="ch.unartig.studioserver.model.ExampleSportsEvent">
<meta attribute="generated-class">ch.unartig.studioserver.model.GeneratedExampleSportsEvent</meta>
<meta attribute="scope-class" inherit="false">public abstract</meta>
</subclass>
</subclass>
</class>
</hibernate-mapping>