Hello,
Im working on a small application with hibernate and spring
There are some problems when I try to use Hibernate Tools for Reverse Engineering (create mapping files from cfg.xml and database)
For the Hibernate Reverse Engineering Wizard a hibernate.cfg.xml is required.
I only have a xml file, where the settings for my database connection and for hibernate are stored.
Now I splitted them in two: the xml file for my database is now looking like this:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
<tx:annotation-driven transaction-manager="txManager"/>
<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation" value="classpath:hibernate.cfg.xml" />
<property name="dataSource" ref="securityDataSource" />
</bean>
<bean id="securityDataSource" destroy-method="close"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="${db.driver}"/>
<property name="url" value="${db.url}"/>
<property name="username" value="${db.user}"/>
<property name="password" value="${db.password}"/>
</bean>
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="WEB-INF/config/backend/db.properties"/>
</bean>
</beans>
and this is my hibernate.cfg.xml
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>
<property name="dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
<mapping resource="users.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Unfortunately by trying to create the reverse engineering file I get this errormessage:
the database drivers are not added to the project classpath. go to project properties and add database library
Thats not possible. I can run the project and the database connection IS working!! So what is missing that I can not create that reverse engineering file??? I tried every library I could imagine.
Until yesterday I used SpringFramework 3.0.2
I even changed to 3.0.4 to see if it would work
I use hibernate3.jar and the mysql jdbc connector.
Here I got two pictures with my libraries in build path. in this moment the webinf/lib folder is empty because it didnt make any difference. please help!!
http://img42.imageshack.us/f/bibs1.png/http://img33.imageshack.us/f/bibs2.png/