Hibernate version:
3.x
Mapping documents:
Bus.hbm.xml:
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">
<!-- Generated 05.05.2006 11:23:58 by Hibernate Tools 3.1.0.beta5 -->
<hibernate-mapping>
<class name="database.BusData" table="bus" catalog="busmaster">
<comment></comment>
<id name="busId" type="int">
<column name="bus_id" />
<generator class="native" />
</id>
<property name="internalId" type="string">
<column name="internal_id" length="20" not-null="true">
<comment></comment>
</column>
</property>
<property name="seats" type="short">
<column name="seats" not-null="true">
<comment></comment>
</column>
</property>
<property name="standingrooms" type="short">
<column name="standingrooms" not-null="true">
<comment></comment>
</column>
</property>
<property name="licenceplate" type="string">
<column name="licenceplate" length="20">
<comment></comment>
</column>
</property>
<property name="technical" type="string">
<column name="technical" length="65535">
<comment></comment>
</column>
</property>
<property name="buscategoryId" type="int">
<column name="buscategory_id" not-null="true">
<comment></comment>
</column>
</property>
<property name="internalbus" type="boolean">
<column name="internalbus" not-null="true">
<comment></comment>
</column>
</property>
<property name="deleted" type="boolean">
<column name="deleted" not-null="true">
<comment></comment>
</column>
</property>
</class>
</hibernate-mapping>
Buscategory.hbm.xml
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">
<!-- Generated 05.05.2006 11:23:58 by Hibernate Tools 3.1.0.beta5 -->
<hibernate-mapping>
<class name="database.BuscategoryData" table="buscategory" catalog="busmaster">
<comment></comment>
<id name="buscategoryId" type="int">
<column name="buscategory_id" />
<generator class="native" />
</id>
<property name="categoryname" type="string">
<column name="categoryname" length="100" not-null="true">
<comment></comment>
</column>
</property>
</class>
</hibernate-mapping>
DB:
http://x-factor.dyndns.org/~austriancod ... 0agent.png
As you can see on the picture, the table bus has a foreign key to buscategory. It sounds maybe silly, but at the moment i have no idea how to add this to the mapping files :(
I have read the docs, but i can't under stand it.
Thanks,
Christian