-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Exception using YesNoType on a property within batch update
PostPosted: Tue Aug 17, 2004 8:02 pm 
Expert
Expert

Joined: Sat Jan 17, 2004 2:57 pm
Posts: 329
Location: In the basement in my underwear
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.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 18, 2004 10:54 am 
Expert
Expert

Joined: Sat Jan 17, 2004 2:57 pm
Posts: 329
Location: In the basement in my underwear
Alright, apparently the 'Boolean' columns aren't supposed to be nullable so that saves my bacon. However, does anyone else find the same thing? (i.e. is it a bug?)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.