Mariadb客户端jar在删除行时引发ArrayIndexoutofbounds异常

时间:2018-07-17 03:52:11

标签: hibernate java-8 spring-data-jpa mariadb

我正在使用mariadb作为我的ORM。我正在使用jpa在表中使用主键删除一行。这是一个简单的本机删除查询。看起来,如果不存在匹配的行,则结果集处理会出现此问题。但是,该行为并不一致,并不经常发生。

@Query(value ="Delete from table where id = :paramId",nativeQuery =true)

 java.lang.ArrayIndexOutOfBoundsException: null
at org.mariadb.jdbc.internal.com.read.Buffer.getLengthEncodedBytes(Buffer.java:318) ~[mariadb-java-client-2.2.0.jar!/:na]
at org.mariadb.jdbc.internal.com.read.resultset.ColumnInformation.getString(ColumnInformation.java:242) ~[mariadb-java-client-2.2.0.jar!/:na]
at org.mariadb.jdbc.internal.com.read.resultset.ColumnInformation.getName(ColumnInformation.java:258) ~[mariadb-java-client-2.2.0.jar!/:na]
at org.mariadb.jdbc.MariaDbResultSetMetaData.getColumnLabel(MariaDbResultSetMetaData.java:187) ~[mariadb-java-client-2.2.0.jar!/:na]
at org.hibernate.dialect.ColumnAliasExtractor$1.extractColumnAlias(ColumnAliasExtractor.java:39) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
at org.hibernate.loader.custom.JdbcResultMetadata.getColumnName(JdbcResultMetadata.java:59) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
at org.hibernate.loader.custom.ScalarResultColumnProcessor.performDiscovery(ScalarResultColumnProcessor.java:39) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
at org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader.java:487) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
at org.hibernate.loader.Loader.getResultSet(Loader.java:2125) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1900) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1876) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
at org.hibernate.loader.Loader.doQuery(Loader.java:919) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:336) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
at org.hibernate.loader.Loader.doList(Loader.java:2617) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
at org.hibernate.loader.Loader.doList(Loader.java:2600) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2429) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
at org.hibernate.loader.Loader.list(Loader.java:2424) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:336) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
at org.hibernate.internal.SessionImpl.listCustomQuery(SessionImpl.java:1967) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
at org.hibernate.internal.AbstractSessionImpl.list(AbstractSessionImpl.java:322) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
at org.hibernate.internal.SQLQueryImpl.list(SQLQueryImpl.java:125) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
at org.hibernate.jpa.internal.QueryImpl.list(QueryImpl.java:606) ~[hibernate-entitymanager-5.0.12.Final.jar!/:5.0.12.Final]
at org.hibernate.jpa.internal.QueryImpl.getSingleResult(QueryImpl.java:529) ~[hibernate-entitymanager-5.0.12.Final.jar!/:5.0.12.Final]

表结构: 创建表instINST_ID INT(11)NOT NULL AUTO_INCREMENT, STATUS_ID SMALLINT(6)NULL缺省NULL, MODULE_ID SMALLINT(6)NULL缺省值'2', STAGE_CONFIG_ID MEDIUMINT(9)NULL缺省NULL, COMMENTS VARCHAR(1000)NULL缺省NULL, IS_LOCKED VARCHAR(1)NULL缺省NULL, LOCKED_BY VARCHAR(100)NULL缺省NULL, RECORD_DATE DATETIME(6)NOT NULL, VERSION INT(11)NULL缺省NULL, ROLE_ID MEDIUMINT(9)NULL缺省NULL, 主键(INST_ID), 唯一索引INST_PKINST_ID), 索引INST_MODULE_FKMODULE_ID), 索引INST_WKF_STAGE_CONFIG_FK1STAGE_CONFIG_ID), 索引INST_IDINST_IDSTAGE_CONFIG_ID), 约束INST_MODULE_FK外键(MODULE_ID)参考moduleMODULE_ID), 约束INST_WKF_STAGE_CONFIG_FK1外键(STAGE_CONFIG_ID)参考stage_configSTAGE_CONFIG_ID) )

0 个答案:

没有答案