Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

exceptions in spring configuration file.

 
indu iyengar
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all ,
while integrating spring with hibernate, my spring configuration file is ::::

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
<property name="prefix" value="/"/>
<property name="suffix" value=".jsp"/>
</bean>

<bean name="/login.htm" class="com.controllers.LoginController">
<property name="validator"><ref bean="loginValidator"/></property>
<property name="formView" value="LoginForm"></property>
<property name="successView" value="LoginSuccess"></property>
<property name="commandName" value="loginStudent"></property>
<property name="commandClass" value="com.bean.LoginStudent"></property>
<property name="sessionForm" value="true"></property>
</bean>

<bean id="loginValidator" class="com.validate.LoginValidator"></bean>

<bean id="messageSource"
class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename" value="messages">
</property>
</bean>

<!-- ********************** DB (Hibernate) details ********************************* -->

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
<property name="password" value="admin"></property>
<property name="url" value="jdbc:mysql:///test"></property>
<property name="username" value="root"></property>
</bean>

<bean id="ex_hibernateProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="properties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>

<bean id="mySessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource"><ref local="dataSource"></ref></property>
<property name="hibernateProperties"><ref local="ex_hibernateProperties"></ref></property>
</bean>

</beans>

when running the following exception is coming ..


I need to provide again hibernateProperties.properties file again ?
 
Sujeeth Pakala
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Indu,


You will have to mention the JDBC Connection details to hibernateProperties Bean definition, which will be used by LocalSessionFactoryBean.

Also, it depends on your type of transaction management you are trying to do!

Hope this helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic