Hello,
i have an inheritance mapping with joined subclass. This was generated by the hibernate reverse engineering tools and converted with xslt... this xml mapping is almost testet and works fine. Now i want to move to Annotation based mapping configuration and had the hope hbm2java would generate everything from the existing xml configuration, but in the generated code i could not see anything like @inheritance as i expected.
does hbm2java support inheritance mapping from an exisitng joined-subclasse configuration?
My base class hbm.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="de.infratour.hbm.Entity" table="entity" catalog="infratour">
<id name="id" type="long">
<column name="id"/>
<generator class="identity"/>
</id>
<many-to-one name="owner" class="de.infratour.hbm.Entity" fetch="select" unique="false" update="true" insert="true" optimistic-lock="true" not-found="exception" embed-xml="true">
<column name="idOwner"/>
</many-to-one>
...
one of my child classes hbm.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<joined-subclass extends="de.infratour.hbm.Entity" name="de.infratour.hbm.Address" table="address" catalog="infratour">
<key column="id"/>
<property name="country" type="string" unique="false" update="true" insert="true" optimistic-lock="true" lazy="false">
<column name="country" length="40"/>
</property>
<property name="state" type="string" unique="false" update="true" insert="true" optimistic-lock="true" lazy="false">
<column name="state" length="40"/>
</property>
<property name="postcode" type="string" unique="false" update="true" insert="true" optimistic-lock="true" lazy="false">
<column name="postcode" length="20"/>
</property>
<property name="city" type="string" unique="false" update="true" insert="true" optimistic-lock="true" lazy="false">
<column name="city" length="80"/>
</property>
<property name="street" type="string" unique="false" update="true" insert="true" optimistic-lock="true" lazy="false">
<column name="street" length="80"/>
</property>
<property name="telPrivat" type="string" unique="false" update="true" insert="true" optimistic-lock="true" lazy="false">
<column name="tel_privat" length="40"/>
</property>
<property name="telMobil" type="string" unique="false" update="true" insert="true" optimistic-lock="true" lazy="false">
<column name="tel_mobil" length="40"/>
</property>
<property name="telBusiness" type="string" unique="false" update="true" insert="true" optimistic-lock="true" lazy="false">
<column name="tel_business" length="40"/>
</property>
</joined-subclass>
</hibernate-mapping>
The generated code:
Code:
/**
* Entity generated by hbm2java
*/
@Entity
@Table(name="entity"
)
public class Entity implements java.io.Serializable {
// Fields
private long id;
private Short version;
...
Code:
/**
* Address generated by hbm2java
*/
@Entity
@Table(name="address"
,catalog=""
)
public class Address extends de.infracore.hbm.Entity implements java.io.Serializable {
// Fields
...
Hibernate version:3.1