Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何解决MyBatis selectForUpdate中的indexOutOfBounds错误?_Java_Mybatis_Spring Mybatis_Mybatis Mapper_Mybatis Sql - Fatal编程技术网

Java 如何解决MyBatis selectForUpdate中的indexOutOfBounds错误?

Java 如何解决MyBatis selectForUpdate中的indexOutOfBounds错误?,java,mybatis,spring-mybatis,mybatis-mapper,mybatis-sql,Java,Mybatis,Spring Mybatis,Mybatis Mapper,Mybatis Sql,我使用postgreSQL。以下是我在myBatisMapper中的请求: <select id="findByStatusAndIdentityAndPrvCode" parameterType="java.lang.String" resultMap="Request"> select from req_tab where status in ('I', 'D', 'Q')

我使用postgreSQL。以下是我在myBatisMapper中的请求:

<select id="findByStatusAndIdentityAndPrvCode" parameterType="java.lang.String" resultMap="Request">
        select
        from req_tab
        where status in ('I', 'D', 'Q')
          and identity = #{identity}
          and prv_code = #{prvCode}
        limit 1 for update
    </select>

原因是什么?如何解决?我解决了这个问题。只需将allArgs构造函数添加到我的实体中

我在使用mysql时遇到了相同的错误。但我通过同时添加noargsconstuctor和allargsconstuctor解决了这个问题。我使用lombok的@Builder,但缺少构造函数注释。 错误日志显示的消息太少,无法找到它

org.apache.ibatis.exceptions.PersistenceException: 
Error querying database.  Cause: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
The error may exist in ru/infogate/dao/mapper/ReqMapper.xml
The error may involve ru.infogate.dao.mapper.ReqMapper.findByStatusAndIdentityAndPrvCode
The error occurred while handling results
SQL: select         from req_tab         where status in ('I', 'D', 'Q')           and identity = ?           and prv_code = ?         limit 1 for update
Cause: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0