开发者

ArrayIndexOutOfBoundsException in Java and Hibernate [duplicate]

This question already has answers here: 开发者_JAVA百科 What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? (26 answers) Closed 6 years ago.

I am using Hibernate and got the exception ArrayIndexOutOfBoundsException. What are the possible causes?


It's possible that Hibernate is throwing this exception in the case you use an old JDBC driver with Oracle. At some point there was a bug in the JDBC diver with the fetch-size, meaning that if the fetch-size you use in Hibernate (hibernate.properties or in hibernate.cfg.xml) was not the same as in jdbc-level, you got an ArrayIndexOutOfBoundsException.


You have tried to access an index which is out of your array size i.e. index < 0 or index >= array.length.

For example int[] myArray = new int[10]; if you access myArray[11] you will get ArrayIndexOutOfBoundsException


You access some index out of the array size. For example, myArray.get(-1);


You are indexing an array with an index out of the size of the Array. It has to do nothing with hibernate.

Check in your code that the index variable is lower than array.size()

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜