views:

84

answers:

4

i am using Hibernate and got the exception ArrayIndexOutOfBoundsException what are the possible causes?

+1  A: 

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

vodkhang
+1  A: 

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()

pakore
+2  A: 

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

Upul
Even if you access `myArray[10]` in that case you'll get an `ArrayIndexOutOfBoundsException`.
Jesper
Thanks Jesper I agree with you. whenever array index satisfies index < 0 or index >= array.length condition we will get ArrayIndexOutOfBoundsException
Upul
+1  A: 

It's possible that hibernate is throwing this exception in the case, you use a 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 than in jdbc-level you got an ArrayIndexOutOfBoundsException.

Testalonga