<?xml version="1.0" ?>
<!DOCTYPE hibernate-mapping PUBLIC 
"-//Hibernate/Hibernate Mapping DTD//EN"
"https://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping package="entity">
    <class name="Employee" table="EMPLOYEES">
        <meta attribute="class-description">
Javadoc for the Employee class
@author
        </meta>

        <id name="id" column="ID"  type="int" >
            <generator class="assigned" />
        </id>

        <property name="name" type="string" column="NAME" not-null="true">
            <meta attribute="field-description">employee name</meta>
            <meta attribute="use-in-tostring">true</meta>
        </property>

        <property name="salary" type="int" column="SALARY">
            <meta attribute="field-description">salary</meta>
            <meta attribute="use-in-tostring">true</meta>
        </property>

        <property name="departmentId" type="int" column="DEPARTMENT_ID" update="true" insert="true">
            <meta attribute="field-description">departmentId</meta>
            <meta attribute="use-in-tostring">true</meta>
        </property>

        <many-to-one name ="department" column="DEPARTMENT_ID"
         class="entity.Department" outer-join="auto"
         update="false" insert="false">
            <meta attribute="use-in-tostring">true</meta>
        </many-to-one>
    </class>

    <query name="entity.Employee.getListByDepartmentName">
        <![CDATA[
            SELECT e
            FROM entity.Employee AS e
            INNER JOIN e.department AS d
            WHERE d.name = :departmentName
        ]]>
    </query>
</hibernate-mapping>