hello,
i have an issue to access the data in mySQL database, with Hibernate framework.
To access to it, I'm using a Spring configuration (xml file), but I got a null pointer exception, so I cannot display the content of a table in my Eclipse console.
Here is my Spring config file:
<?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:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schem...ring-beans.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schem...spring-aop.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schem...ng-context.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/base" />
<property name="username" value="root" />
<property name="password" value="admin" />
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotati on.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="annotatedClasses">
<list>
<value>hibernate.test.web.model.Acteur</value>
<value>hibernate.test.web.model.Affectation</value>
<value>hibernate.test.web.model.Catalogue</value>
<value>hibernate.test.web.model.Conges</value>
<value>hibernate.test.web.model.Consotaches</value>
<value>hibernate.test.web.model.Devis</value>
<value>hibernate.test.web.model.Enveloppes</value>
<value>hibernate.test.web.model.EnveloppesId</value>
<value>hibernate.test.web.model.Profil</value>
<value>hibernate.test.web.model.Projet</value>
<value>hibernate.test.web.model.Risques</value>
<value>hibernate.test.web.model.Tachesdevis</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQ LInnoDBDialect</prop>
</props>
</property>
</bean>
<bean id ="transactionManager" class="org.springframework.orm.hibernate3.Hibernat eTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<tx:annotation-driven transaction-manager="transactionManager"/>
<context:annotation-config />
<context:component-scan base-package="hibernate.test.web" />
</beans>
Thanks for your help.


Reply With Quote
