WSAD5 with Hibernate

03-08-19 xinxin2


I just have a Web Project, and inside the Java Source, I have a java class (setter/getter), and a servlet (calling Hibernate Configure to get session), I have tried to put hibernate.cfg.xml file to each directory(WEB-INF/classes, WEB-INF, Java Source, ...), but all do not work at all, I don't know why, do you know where the .cfg.xml need to be put? Or do I need to have the .cfg.xml file path in web.xml? I have no idea.

Do you have an example about creating a web application using WSAD5 and Hibernate?

Thanks so much for helps.

The error message is:


" I net.sf.hibernate.cfg.Configuration Configuration resource: /hibernate.cfg.xml

7bff0b53 Configuration W net.sf.hibernate.cfg.Configuration /hibernate.cfg.xml not found

7bff0b53 WebGroup E SRVE0026E: [Servlet Error]-[/hibernate.cfg.xml not found]: net.sf.hibernate.HibernateException: /hibernate.cfg.xml not found





<?xml version='1.0' encoding='utf-8'?>

<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"

""> />



<property name="hibernate.connection.driver_class"></property>

<property name="hibernate.connection.url">jdbc:db2:JDO</property>

<property name="hibernate.connection.username">admin</property>

<property name="hibernate.connection.password">admin</property>

<property name="show_sql">true</property>

<property name="use_outer_join">true</property>

<property name="dialect">net.sf.hibernate.dialect.DB2Dialect</property>

<!-- Mapping files -->

<mapping resource="Cat.hbm.xml"/>




2003-08-20 13:19


2003-08-20 21:00
Thank you yehs220 for helping!

I will try to put .cfg.xml to the classpath root. Thanks