hsweb-framework icon indicating copy to clipboard operation
hsweb-framework copied to clipboard

常见问题及解决方式

Open zhou-hao opened this issue 7 years ago • 9 comments

使用hsweb时的常见问题及解决方式

这里只列出了常见问题的解决方式,如果有更多问题,请在下方留言或者提交issues

mybatis报错1

There is no getter for property named 'xxxx' in 'class org.hswebframework.web.commons.entity.param.QueryParamEntity'

检查 Mapper.xml中的配置项:

 <sql id="config">
 <!--
注意: value值是ognl表达式,因此要使用单引号来声明字符串,例如: 's_organization' 
-->
        <bind name="resultMapId" value="'OrganizationalResultMap'"/>
        <bind name="tableName" value="'s_organization'"/> 
  </sql>

mybatis报错2:

Invalid bound statement (not found): com.xxxx.Xxxxx.select

  1. 检查Mapper.xml是否被编译到target. 建议将xml都放到src/resources目录下
  2. 检查Mapper.xml所在的包名, 在文件系统里是否为com/xxx/Xxxx.xml 而不是 com.xxx/Xxxx.xml
  3. 检查application.yml中是否配置了mybaits.mapper-locations 配置,例如:
mybatis:
    mapper-locations: com/xxx/**/*.xml

zhou-hao avatar Oct 19 '18 08:10 zhou-hao

您好,跑单元测试,新增一个用户,为何同一个方法会调用两次? 如: org.hswebframework.web.authorization.Authentication.UserTests createTestUser() 其中 userService.insert(userEntity); 执行两次, 导致事务回滚

22996963 avatar Jul 18 '19 09:07 22996963

@22996963 提供一下具体的代码

zhou-hao avatar Jul 18 '19 10:07 zhou-hao

@zhou-hao 解决了,测试代码的问题。

22996963 avatar Jul 24 '19 03:07 22996963

您好, hsweb用户手册 - 增删改查 - 通用CRUD - Mybatis/TestMapper.xml 这个文件里的
<include refid="BasicMapper.buildInsertSql"/> refid在前面没有定义啊,在测试的时候报错: {"message":"Could not find SQL statement to include with refid 'BasicMapper.buildInsertSql'","status":500,"timestamp":1578578895439}

kongqiu avatar Jan 09 '20 14:01 kongqiu

@kongqiu 引入hsweb-commons-mybatis没

zhou-hao avatar Jan 09 '20 14:01 zhou-hao

@zhou-hao 引入了,还是报同样的错。

             <dependency>
                <groupId>org.hswebframework.web</groupId>
                <artifactId>hsweb-commons-mybatis</artifactId>
                <version>${hsweb.framework.version}</version>
            </dependency>

kongqiu avatar Jan 10 '20 07:01 kongqiu

@kongqiu 你用这个例子看会不会报错 https://github.com/hs-web/hsweb-examples/tree/master/myproject

zhou-hao avatar Jan 10 '20 08:01 zhou-hao

@zhou-hao 解决了,谢谢。把pom.xml里的东西拷贝到我的项目里重新导入依赖包后没问题了,还是依赖的问题。

kongqiu avatar Jan 10 '20 11:01 kongqiu

not in没有空格

sunguoji avatar Jan 21 '21 13:01 sunguoji