关注JEECG发展历程 关注最新动态和版本, 记录JEECG成长点滴 更新日志 - 技术支持 - 招聘英才

JEECG最新版本下载 JEECG智能开发平台 - 显著提高开发效率 常见问题 - 入门视频 - 参与开源团队

商务QQ: 69893005、418799587 商务热线(5*8小时): 010-64808099 官方邮箱: jeecgos@163.com

查看: 8883|回复: 6

[Minidao] minidao未能调用到SQL语句

[复制链接]
发表于 2018-5-23 16:07:05 | 显示全部楼层 |阅读模式
    控制台输出结果是:
   

测试方法

测试方法

service方法

service方法
[com.trilink.model.User:24].................................................begin.......................[org.springframework.test.context.support.DirtiesContextTestExecutionListener:94]After test method: context [DefaultTestContext@5ed74c35 testClass = UserJunit, testInstance = test.UserJunit@8cc5c38, testMethod = getCount@UserJunit, testException = java.lang.NullPointerException, mergedContextConfiguration = [MergedContextConfiguration@20ba650b testClass = UserJunit, locations = '{classpath:spring-hibernate.xml}', classes = '{}', contextInitializerClasses = '[]', activeProfiles = '{}', contextLoader = 'org.springframework.test.context.support.DelegatingSmartContextLoader', parent = [null]]], class dirties context [false], class mode [null], method dirties context [false].
[org.springframework.test.context.support.DirtiesContextTestExecutionListener:126]After test class: context [DefaultTestContext@5ed74c35 testClass = UserJunit, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [MergedContextConfiguration@20ba650b testClass = UserJunit, locations = '{classpath:spring-hibernate.xml}', classes = '{}', contextInitializerClasses = '[]', activeProfiles = '{}', contextLoader = 'org.springframework.test.context.support.DelegatingSmartContextLoader', parent = [null]]], dirtiesContext [false].
[org.springframework.context.support.GenericApplicationContext:875]Closing org.springframework.context.support.GenericApplicationContext@7c935c95: startup date [Wed May 23 15:56:05 CST 2018]; root of context hierarchy
[org.springframework.beans.factory.support.DefaultListableBeanFactory:247]Returning cached instance of singleton bean 'lifecycleProcessor'
[org.springframework.beans.factory.support.DefaultListableBeanFactory:486]Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@335ee1b3: defining beans [org.springframework.aop.config.internalAutoProxyCreator,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.context.support.PropertySourcesPlaceholderConfigurer#0,dataSource_enter,dataSource,sessionFactory,jdbcTemplate,namedParameterJdbcTemplate,miniDaoHandler,transactionManager,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,txAdvice,transactionPointcut,org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor]; root of factory hierarchy
[org.springframework.beans.factory.support.DefaultListableBeanFactory:542]Retrieved dependent beans for bean '(inner bean)#2d450bdf': [txAdvice]
[org.springframework.beans.factory.support.DisposableBeanAdapter:245]Invoking destroy() on bean with name 'sessionFactory'
[org.hibernate.internal.SessionFactoryImpl:1386]HHH000031: Closing
[org.springframework.beans.factory.support.DisposableBeanAdapter:323]Invoking destroy method 'close' on bean with name 'dataSource_enter'
[com.alibaba.druid.pool.DruidDataSource:982]{dataSource-1} closed


Dao方法

Dao方法
发表于 2018-5-24 09:35:36 | 显示全部楼层
扫描路径配置了吗
src/main/resources/spring-minidao.xml
 楼主| 发表于 2018-5-26 11:10:24 | 显示全部楼层
配置了,minidao与hibernate整合需要配置些什么?

spring-minidao.xml

spring-minidao.xml
发表于 2018-5-27 21:41:02 | 显示全部楼层
你配置了事务?是sql执行成功了?数据库没变化?
 楼主| 发表于 2018-5-28 09:08:09 | 显示全部楼层
配置了事务,SQL没有执行,我查询数据库数据在控制台没有sql语句输出,dao方法返回空指针异常。
发表于 2018-5-28 15:33:39 | 显示全部楼层
把就是报错了,把错误日志贴出来
 楼主| 发表于 2018-5-28 16:32:11 | 显示全部楼层
没有报错,控制台输出信息:[com.trilink.model.User:24].................................................begin.......................[org.springframework.test.context.support.DirtiesContextTestExecutionListener:94]After test method: context [DefaultTestContext@5ed74c35 testClass = UserJunit, testInstance = test.UserJunit@8cc5c38, testMethod = getCount@UserJunit, testException = java.lang.NullPointerException, mergedContextConfiguration = [MergedContextConfiguration@20ba650b testClass = UserJunit, locations = '{classpath:spring-hibernate.xml}', classes = '{}', contextInitializerClasses = '[]', activeProfiles = '{}', contextLoader = 'org.springframework.test.context.support.DelegatingSmartContextLoader', parent = [null]]], class dirties context [false], class mode [null], method dirties context [false].
[org.springframework.test.context.support.DirtiesContextTestExecutionListener:126]After test class: context [DefaultTestContext@5ed74c35 testClass = UserJunit, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [MergedContextConfiguration@20ba650b testClass = UserJunit, locations = '{classpath:spring-hibernate.xml}', classes = '{}', contextInitializerClasses = '[]', activeProfiles = '{}', contextLoader = 'org.springframework.test.context.support.DelegatingSmartContextLoader', parent = [null]]], dirtiesContext [false].
[org.springframework.context.support.GenericApplicationContext:875]Closing org.springframework.context.support.GenericApplicationContext@7c935c95: startup date [Wed May 23 15:56:05 CST 2018]; root of context hierarchy
[org.springframework.beans.factory.support.DefaultListableBeanFactory:247]Returning cached instance of singleton bean 'lifecycleProcessor'
[org.springframework.beans.factory.support.DefaultListableBeanFactory:486]Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@335ee1b3: defining beans [org.springframework.aop.config.internalAutoProxyCreator,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.context.support.PropertySourcesPlaceholderConfigurer#0,dataSource_enter,dataSource,sessionFactory,jdbcTemplate,namedParameterJdbcTemplate,miniDaoHandler,transactionManager,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,txAdvice,transactionPointcut,org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor]; root of factory hierarchy
[org.springframework.beans.factory.support.DefaultListableBeanFactory:542]Retrieved dependent beans for bean '(inner bean)#2d450bdf': [txAdvice]
[org.springframework.beans.factory.support.DisposableBeanAdapter:245]Invoking destroy() on bean with name 'sessionFactory'
[org.hibernate.internal.SessionFactoryImpl:1386]HHH000031: Closing
[org.springframework.beans.factory.support.DisposableBeanAdapter:323]Invoking destroy method 'close' on bean with name 'dataSource_enter'
[com.alibaba.druid.pool.DruidDataSource:982]{dataSource-1} closed
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表