Giriş
Dosya ismi
<classname>.hbm.xml şeklindedir.
class tag
name, tablei dynamic-update,dynamic-insert,select-before-update,optimistic-lock attribute alanları olabilir.
id tag
joined-subclass tag
Kalıtımı gösterir
key tag
Primary key alanını gösterir
property tag
Sütunu gösterir
many-to-one tag
Örnek - fetch
Şöyle
yaparız.
<hibernate-mapping>
<class name="test.project.TableA" table="TABLE_A">
...
<many-to-one name="nameA" class="test.project.TableB"
fetch="select">
<column name="tableb_primary_id" precision="16" scale="0" not-null="true" />
</many-to-one>
</hibernate-mapping>
Örnek - cascade
Şöyle
yaparız.
<?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 package="com.floreantpos.model">
<class lazy="false" name="com.floreantpos.model.PosTransaction"
table="TRANSACTIONS">
<id column="ID" name="id" type="java.lang.Integer">
<generator class="identity" />
</id>
<!-- card -->
<property column="CARD_HOLDER_NAME" length="60" name="cardHolderName" type="string" />
...
<!-- uni-directional many-to-one association to Terminal -->
<many-to-one class="com.floreantpos.model.Terminal" name="terminal" cascade="none">
<column name="TERMINAL_ID" />
</many-to-one>
...
</class>