Hi,
when tried to connect to database from
servlet through hibernate,I am getting the below error
net.sf.hibernate.MappingException: Error reading resource: Employee.hbm.xml
Here Employee is my Persistence class.
Here are my configuration files.
hibernate.cfg file
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 2.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
<property name="hibernate.connection.url">
jdbc ostgresql://192.168.1.112/work</property>
<property name="hibernate.connection.username">infinity</property>
<property name="hibernate.connection.password">infinity</property>
<property name="hibernate.dialect">net.sf.hibernate.dialect.PostgreSQLDialect</property>
<property name="show_sql">true</property>
<property name="transaction.factory_class">
net.sf.hibernate.transaction.JDBCTransactionFactory
</property>
<property name="hibernate.cache.provider_class">
net.sf.hibernate.cache.HashtableCacheProvider
</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<mapping resource="Employee.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Employee.hbm file
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="pack.hib.Employee" table="emp_tab">
<id name="empNumber" column="eno" type="Integer">
<generator class="increment"/>
</id>
<property name="ename" />
<property name="salary"/>
</class>
</hibernate-mapping>
i placed the above configuration files,persistent class and servlet under classes directory.
please suggest me ,what i have to do to fix this error.
Thanks in Advance,
Siva Sankar.