Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

常见问题及解决方式 #97

Closed
zhou-hao opened this issue Oct 19, 2018 · 9 comments
Closed

常见问题及解决方式 #97

zhou-hao opened this issue Oct 19, 2018 · 9 comments

Comments

@zhou-hao
Copy link
Member

使用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 zhou-hao self-assigned this Oct 19, 2018
@zhou-hao zhou-hao reopened this Nov 21, 2018
@zhou-hao zhou-hao pinned this issue Dec 29, 2018
@hs-web hs-web deleted a comment from SERE026 Jun 30, 2019
@22996963
Copy link

22996963 commented Jul 18, 2019

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

@zhou-hao
Copy link
Member Author

@22996963 提供一下具体的代码

@22996963
Copy link

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

@kongqiu
Copy link

kongqiu commented Jan 9, 2020

您好, 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}

@zhou-hao
Copy link
Member Author

zhou-hao commented Jan 9, 2020

@kongqiu 引入hsweb-commons-mybatis没

@kongqiu
Copy link

kongqiu commented Jan 10, 2020

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

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

@zhou-hao
Copy link
Member Author

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

@kongqiu
Copy link

kongqiu commented Jan 10, 2020

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

@sunguoji
Copy link

not in没有空格

@zhou-hao zhou-hao unpinned this issue May 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants