org.hibernate.HibernateException: No CurrentSessionContext configured!

2025-02-25 15:10:53
推荐回答(2个)
回答1:


xmlns:aop="http://www.springframework.org/schema/aop" 
xmlns:context="http://www.springframework.org/schema/context"  
xmlns:p="http://www.springframework.org/schema/p" 
xmlns:tx="http://www.springframework.org/schema/tx"  
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-4.0.xsd    
http://www.springframework.org/schema/context  
http://www.springframework.org/schema/context/spring-context-4.0.xsd    
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd       
http://www.springframework.org/schema/tx  
http://www.springframework.org/schema/tx/spring-tx-4.0.xsd" default-autowire="byName">   



id="dataSource"   
class="org.springframework.jdbc.datasource.DriverManagerDataSource">   
name="driverClassName" 
value="${jdbc.driverClassName}" />   
name="url" 
value="${jdbc.url}" />    
name="username" 
value="${jdbc.username}" />    
name="password" 
value="${jdbc.password}" />   
    



       
${hibernate.dialect}         
${hibernate.show_sql}



    
  
      
        
            class="org.springframework.orm.hibernate4.HibernateTransactionManager">  
          
      
      
      
          
              
        
  
      
      
      
          
          
    

我的是这样的。。。没有问题。

回答2:

你这是事务配置 你看看spring和hibernate连接的那个xml文件 比如你这里报错误时候用到的service或者dao
打字不易,如满意,望采纳。