-->
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.  [ 1 post ] 
Author Message
 Post subject: Mapping Properties-like classes (string/object), v2.1.2
PostPosted: Tue Mar 02, 2004 2:40 am 
Newbie

Joined: Tue Mar 02, 2004 2:22 am
Posts: 5
I'm having problems mapping a a Properties class in Hibernate 2.1.2.
The class has only 2 fields, a String "name" and an Object "value".

Although class2hbm suggest a mapping with only 2 fields, like:
<hibernate-mapping>
<!-- jade.domain.FIPAAgentManagement.Property root -->
<class name="jade.domain.FIPAAgentManagement.Property" table="Property">
<id name="name" type="string">
<column name="name" length="16"/>
<generator class="uuid.hex"/>
</id>
<property name="value" column="value" type="object"/>
</class>
</hibernate-mapping>

.. I keep getting the exception below when using similar approach:
net.sf.hibernate.MappingException: collection element mapping has wrong number of columns: jade.lang.acl.ACLMessage.envelope.properties.data type: jade.domain.FIPAAgentManagement.Property
at net.sf.hibernate.mapping.Collection.validate(Collection.java:256)
at net.sf.hibernate.mapping.IndexedCollection.validate(IndexedCollection
.java:56)
at net.sf.hibernate.cfg.Configuration.validate(Configuration.java:589)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.
java:744)
...

Debugging I noticed that ObjectType (for value) returns a columnSpan of
2, plus 1 (for name) which results in 3. How should I map the "value" field?

My actual mapping fragment:
...
<component name="properties">
<list name="data" table="env_props" cascade = "all-delete-orphan">
<key column="owner"/>
<index column="idx"/>
<composite-element class="jade.domain.FIPAAgentManagement.Property">
<property name="name" column="name" type="string"/>
<property name="value" column="value" type="object"/>
</composite-element>
</list>
</component>
...

Tks,
Diego


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

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.