Hibernate version:
2.1.5
Full stack trace of any exception that occurs:
Caused by: java.lang.ArrayIndexOutOfBoundsException: 14
at net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:57)
at net.sf.hibernate.impl.BatchingBatcher.addToBatch(BatchingBatcher.java:34)
at net.sf.hibernate.persister.EntityPersister.update(EntityPersister.java:684)
at net.sf.hibernate.persister.EntityPersister.update(EntityPersister.java:642)
at net.sf.hibernate.impl.ScheduledUpdate.execute(ScheduledUpdate.java:52)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2281)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2236)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2107)
... 26 more
Name and version of the database you are using:
Oracle 9i
Having a weird issue and was wondering if anyone else could confirm.
For whatever reason, it was decided eons ago that Booleans would be represented in the DB using 'Y' and 'N' (I'm a 1/0 guy myself).
To map this we are using the YesNoType packaged with Hibernate.
Code:
<property
name="autoSavepointFlg"
type="net.sf.hibernate.type.YesNoType"
update="true"
insert="true"
access="property"
column="AUTO_SAVEPOINT_FLG"
/>
and the Java code for the property
Code:
public Boolean getAutoSavepointFlg() {
return this.autoSavepointFlg;
}
public void setAutoSavepointFlg(Boolean autoSavepointFlg) {
Boolean oldValue = this.autoSavepointFlg;
this.autoSavepointFlg = autoSavepointFlg;
firePropertyChange(AUTO_SAVEPOINT_FLG_PROPERTY, oldValue, this.autoSavepointFlg);
}
Everything is fine if the property is at the root level of saving an object. i.e. this property is from a Class called Item. If I save an item, everything works fine.
However, if I save an item as part of a cascaded collection the wheels fall off with the above exception.
If I remove the YesNoType (or the TrueFalseType - tried that as well) everything is fine just using the BooleanType. However if I use the YesNo or TrueFalse chaos ensues.
Ok, actually here is an even narrower scope...if even 1 of the records I'm trying to save has the YesNoType property NULL and I try to update 1 to not NULL the exception happens. But if they are all NULL or all NOT NULL then it doesn't happen.
To recap:
Save ALL (in the collection) as Boolean.TRUE, Boolean.FALSE, Boolean.TRUE/FALSE, or NULL everything is fine.
Mix Boolean.TRUE/Boolean.FALSE in with a NULL, bad things happen.
However, the BooleanType has no issue with the mixture.
Don't even get me started on what a NULL boolean might possibly mean, heh.