当前位置: 代码迷 >> J2EE >> org.hibernate.HibernateException: No Session found for current thread解决办法
  详细解决方案

org.hibernate.HibernateException: No Session found for current thread解决办法

热度:8140   发布时间:2013-02-25 21:39:50
org.hibernate.HibernateException: No Session found for current thread
这是applicationContext.xml

<?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"
    xmlns:aop="http://www.springframework.org/schema/aop" 
xmlns:p="http://www.springframework.org/schema/p"
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 
                           http://www.springframework.org/schema/aop  
                           http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
                              

<!-- 数据元配置 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
  <property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
  <property name="url" value="jdbc:mysql://localhost:3306/callsystem"></property>
  <property name="username" value="root"></property>
  <property name="password" value="521958k42jv"></property>   
</bean>

<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
  <property name="dataSource" ref="dataSource"></property>
  <property name="mappingResources">
    <list>
      <value>/hbm/xml/Group/user.hbm.xml</value>
      <value>/hbm/xml/Group/userMap.hbm.xml</value>
      <value>/hbm/xml/Group/set_meal.hbm.xml</value>
      <value>/hbm/xml/Group/card.hbm.xml</value>
      <value>/hbm/xml/Group/history.hbm.xml</value>
      <value>/hbm/xml/Group/action.hbm.xml</value>
    </list>
  </property>
  <property name="hibernateProperties">
    <props>
      <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
      <!-- <prop key="hibernate.hbm2ddl.auto">update</prop> -->
      <prop key="hibernate.show_sql">false</prop>
      <prop key="hibernate.format_sql">true</prop>
  相关解决方案
本站暂不开放注册!
内测阶段只得通过邀请码进行注册!