Hello Hibernators,
I have a one-to-many mapping in my code. When I changed the mapping from a <set> to a <list> (because we need to order the elements, I started getting ArrayIndexOutOfBounds exceptions
My original, working mapping file looks like this:
Code:
<set
name="bflySizeValues"
lazy="true"
inverse="true"
cascade="none"
>
<key>
<column name="BFLY_SIZE_CHART_ID"/>
</key>
<one-to-many
class="com.bluefly.apps.manager.domain.BflySizeValue"
/>
</set>
and my altered one looks like this
Code:
<list
name="bflySizeValues"
inverse="true"
cascade="all"
>
<key>
<column name="BFLY_SIZE_CHART_ID"/>
</key>
<list-index column="SORT_ORDER" base="1"/>
<one-to-many
class="com.bluefly.apps.manager.domain.BflySizeValue"
/>
</list>
My stack trace is:
Code:
Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.set(ArrayList.java:339)
at org.hibernate.collection.PersistentList.readFrom(PersistentList.java:386)
at org.hibernate.loader.Loader.readCollectionElement(Loader.java:1008)
at org.hibernate.loader.Loader.readCollectionElements(Loader.java:646)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:591)
at org.hibernate.loader.Loader.doQuery(Loader.java:701)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.loadCollection(Loader.java:1998)
at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:36)
at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:565)
at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:63)
at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1717)
at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:344)
at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
at org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:109)
at org.hibernate.collection.PersistentList.size(PersistentList.java:91)
at com.bluefly.apps.manager.domain.BflySizeChart.setBflySizeValues(BflySizeChart.java:165)
... 172 more
Can somebody help me debug this? I turned on show_sql and executed the SQL, I didn't see any suspicious data