Java 如何解决MyBatis selectForUpdate中的indexOutOfBounds错误?
我使用postgreSQL。以下是我在myBatisMapper中的请求: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')
<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