Hibernate version:3.2
Name and version of the database you are using:
MySql 5
ok heres the story, i been developing a web app in eclipse 3.3.1 using hibernate , the proyect structure is like this
[P]MyWebApp
|--[S]src
| |-[p]hbms
| | | - User.hbm.xml
| | | - Tikcet.hbm.xml
| |---- hibernate.cfg.xml
|--[S] DataLayer
| |-[p]myapp.data
| |--user.java
| |--user.java
|--[S] BusinessLayer
| |-[p]myapp.business
|--[S] WebLayer
| |-[p]myapp.web
|--[S] Tests
|-[p]myapp.tests.web
|-[p]myapp.tests.business
|-[p]myapp.tests.data
P -> proyect
S -> source folder
p -> package
as you can see i have diferent source folders in my eclipse proyect, one for each layer plus one for test cases, aditional to that i have the folder "src" wich is created automatically, when i run my tests i include my mapping files like this :
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
...........
<mapping file="src/User.hbm.xml"/>
<mapping file="src/Ticket.hbm.xml" />
</session-factory>
</hibernate-configuration>
and create my session factory like this :
Code:
Configuration config = new Configuration();
config = config.configure("src/hibernate.cfg.xml");
sessionFactory = config.buildSessionFactory();
and everything works ok, but when i try to run my app on server i got
"org.hibernate.HibernateException: src/hibernate.cfg.xml not found"
so i changed my session factory code to this:
Code:
Configuration config = new Configuration();
config = config.configure();
sessionFactory = config.buildSessionFactory();
and i got :
"org.hibernate.MappingNotFoundException: file: src\User.hbm.xml "
so i changed the configuration file like this:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
...........
<mapping file="hbms/User.hbm.xml"/>
<mapping file="hbms/Ticket.hbm.xml" />
</session-factory>
</hibernate-configuration>
and still got the Mapping not found exception, also moved the hmb files in the same foler as hibernate.cfg.xml and include them like this:
Code:
<mapping file="User.hbm.xml"/>
<mapping file="Ticket.hbm.xml"/>
other thing i tried was to put the hbm files next o the .java files and include them like this:
Code:
<mapping file="myapp/data/User.hbm.xml"/>
<mapping file="myapp/data/Ticket.hbm.xml"/>
and still got the same exception.
ive searched the forums and found:
http://forum.hibernate.org/viewtopic.php?t=986723
http://forum.hibernate.org/viewtopic.php?p=2387656
but none of these help, any idea any one?
thanks inadvance !