-->
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: Using java.lang.Object as a type
PostPosted: Fri Dec 12, 2003 4:21 pm 
Newbie

Joined: Sat Nov 22, 2003 8:42 pm
Posts: 9
I tried mapping an object which has a java.lang.Object attribute as a joined-subclass. That part of my hbm.xml file is something like this:

...
<joined-subclass name="MySubclass" table="mysubclass_table">
<key column="subclass"/>
<property name="objectValue" type="java.lang.Object"/>
</joined-subclass>
...

where I also tried using type = "object".

The mapping also includes other joined-subclasses, but I can't get it to work with any of those types. I can do code and schema generation (which work fine), but when I try to get a sessionFactory from this Configuration I get:

java.lang.ArrayIndexOutOfBoundsException: 1
at net.sf.hibernate.util.ArrayHelper.slice(ArrayHelper.java:59)
at net.sf.hibernate.loader.OuterJoinLoader.walkComponentTree(OuterJoinLoader.java:230)
at net.sf.hibernate.loader.OuterJoinLoader.walkClassTree(OuterJoinLoader.java:191)
at net.sf.hibernate.loader.OuterJoinLoader.walkTree(OuterJoinLoader.java:74)
at net.sf.hibernate.loader.OneToManyLoader.(OneToManyLoader.java:57)
at net.sf.hibernate.collection.CollectionPersister.createCollectionQuery(CollectionPersister.java:277)
at net.sf.hibernate.collection.CollectionPersister.(CollectionPersister.java:268)
at net.sf.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:216)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:627)
...

Other types work fine with this subclass and others. Please tell me if there is a way to map this kind of type or I should use some other.

Thanks a lot for your help once again.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 12, 2003 4:22 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
If your property may be of different persistent types, you can use a <any> mapping


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 13, 2003 6:16 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
reread Hibernate refdrence guide section 5.1.9
java.lang.Object is not an acceptable type of property

_________________
Emmanuel


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.