-->
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.  [ 3 posts ] 
Author Message
 Post subject: Possible bug in the handling of boolean arrays?
PostPosted: Mon Jun 21, 2004 7:41 am 
Newbie

Joined: Wed Nov 05, 2003 6:05 am
Posts: 6
Hello,

I would like to map an array of booleans with the folllowing mapping:

Code:
<subclass name="hu.mobidiak.model2.MultiChoiceTestItem" discriminator-value="M">

     <array name="correct" table="t_correct">
         <key column="item_id"/>
         <index column="i"/>
         <element type="boolean" column="value" not-null="true"/>
      </array>

</subclass>


I can save objects of this class using session.save() but when I try to reload an instance with session.load() the following exception is thrown:

Code:
2004-06-21 13:23:58,252 [main] ERROR net.sf.hibernate.property.BasicPropertyAccessor - IllegalArgumentException in class: hu.mobidiak.model2.MultiChoiceTestItem, setter method of property: correct
2004-06-21 13:23:58,254 [main] ERROR net.sf.hibernate.property.BasicPropertyAccessor - expected type: [Z, actual value: [Ljava.lang.Boolean;
2004-06-21 13:23:58,256 [main] ERROR hu.mobidiak.db2.PersistenceManager - net.sf.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of hu.mobidiak.model2.MultiChoiceTestItem.correct
net.sf.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of hu.mobidiak.model2.MultiChoiceTestItem.correct
        at net.sf.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:68)
        at net.sf.hibernate.persister.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:221)
        at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:2206)
        at net.sf.hibernate.loader.Loader.doQuery(Loader.java:240)
        at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
        at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:915)
        at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:890)
        at net.sf.hibernate.loader.OneToManyLoader.initialize(OneToManyLoader.java:93)
        at net.sf.hibernate.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:284)
        at net.sf.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:3264)
        at net.sf.hibernate.collection.PersistentCollection.forceInitialization(PersistentCollection.java:336)
        at net.sf.hibernate.impl.SessionImpl.initializeNonLazyCollections(SessionImpl.java:3119)
        at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:138)
        at net.sf.hibernate.loader.Loader.doList(Loader.java:955)
        at net.sf.hibernate.loader.Loader.list(Loader.java:946)
        at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:846)
        at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1543)
        at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
        at hu.mobidiak.db2.PersistenceManager.query(PersistenceManager.java:385)
        at hu.mobidiak.db2.TestManager.getTest(TestManager.java:29)
        at hu.mobidiak.db2.TestManager.getTest(TestManager.java:39)
        at hu.mobidiak.test.TestPrinter.main(TestPrinter.java:130)
Caused by: java.lang.IllegalArgumentException: argument type mismatch
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at net.sf.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:38)
        ... 21 more


The error occurs in the following environment: RedHat Linux 9, PostgreSQL 7.3.4 , HIbernate 2.1.4.

If I use an array of Booleans (Boolean[]) in the class instead of an array of primitive boolean values then everything goes fine. Is it a bug in the handling of boolean arrays?

Best regards,

Peter


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 21, 2004 9:03 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Use primitive-array for primitive arrays


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 21, 2004 10:50 am 
Newbie

Joined: Wed Nov 05, 2003 6:05 am
Posts: 6
Thanks for your reply, that solved the problem.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.