Hibernate Mapping exception Error

Hello team, How can I fix this error: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.hibernate.MappingException: Unknown entity: org.openmrs.module.test.Department

This is how my hibernate file looks like

<?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.openmrs.module.test">
    <class name="Department" table="test_department" lazy="false">
        <id name="departmentId" type="int" column="department_id" unsaved-value="0">
            <generator class="native" />
        </id>
        <discriminator column="department_id" insert="false" />
        <property name="uuid" type="java.lang.String" column="uuid" length="38" unique="true" />
        <property name="name" type="java.lang.String" column="name" length="255" unique="true" />
        <property name="description" type="java.lang.String" column="description" length="255" />    
    </class>
</hibernate-mapping>

Any help is highly welcomed.

@byenkya Sorry about this, Kindly share the entire log using pastebin.com. Also you could share git repository link for your department module.

Your Department.hbm.xml is not scanned in the classPath.

Hello @byenkya Go ahead and add this file in Department.hbm.xml like this draft fix here

<hibernate-mapping package="org.openmrs.module.test">
    <class name="Department" table="test_department" lazy="false">
        <id name="departmentId" type="int" column="department_id" unsaved-value="0">
            <generator class="native" />
            <param name="sequence">test_department_department_id_seq</param>
        </id>
        <discriminator column="department_id" insert="false" />
        <property name="uuid" type="java.lang.String" column="uuid" length="38" unique="true" />
        <property name="name" type="java.lang.String" column="name" length="255" unique="true" />
        <property name="description" type="java.lang.String" column="description" length="255" />    
    </class>
    <mappingFiles>
		Department.hbm.xml
	</mappingFiles>
</hibernate-mapping>

Note that you need to also fix the department list. form. It’s not available so fix it in the controller by redirecting to a different form.

Added two lines one for Mapping files, and the param name. , i think we need to update our documentation for developing the basic module.

Best Regards