Friday, July 29, 2011

HIBERNATE Examples - Step 2. Creating HBM

The following are the HBMs defined for the examples used.

Departments.hbm.xml

<?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 package="org.mybusiness.pojos">
    <class name="org.mybusiness.pojos.Departments" table="departments">
        <id column="DEPT_ID" name="deptId">
            <generator class="increment" />
        </id>

        <property name="deptName" column="NAME" update="false" />

        <property name="yearStarted" column="YEAR_STARTED" update="false" />        
    </class>
</hibernate-mapping>

No comments:

Post a Comment