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
|