I have a class that can contain properties. Like so
Code:
class DBNamedObject extends Xxx{
Map properties;
public Map getProperties(){
return this.properties;
}
public String getProperty(DBPropertyType key) {
return (String)this.properties.get(key);
}
public String setProperty(DBPropertyType key, String value){
return (String)this.properties.put(key,value);
}
}
in this case DBPropertyType is a persistable class and I am using it for the key to the map. But Hibernate is complaining that it does not know the type of the key!?!
I don't know why because the type is fully defined in the xml file.
Any ideas?
This is the class that contains the map
Code:
<hibernate-mapping>
<joined-subclass name="com.rgdsft.hibernate.core.models.DBNamedObject" extends="com.rgdsft.hibernate.core.models.DBObject">
<key column="OBJECT_ID"/>
<property name="name"
not-null="true"
type="string"/>
<map name="properties" table="PROPERTIES">
<key column="DBNamedObject_ID" not-null="true"/>
<map-key column="PROPERTY_ID" type="com.rgdsft.hibernate.core.models.DBPropertyType"/>
<element column="PROPERTY_VALUE" type="string" not-null="true"/>
</map>
</joined-subclass>
</hibernate-mapping>
This is the class that is used as a key in the map
Code:
<hibernate-mapping>
<joined-subclass name="com.rgdsft.hibernate.core.models.DBPropertyType" extends="com.rgdsft.hibernate.core.models.DBObject">
<key column="OBJECT_ID"/>
<!-- needs unique name and project -->
<many-to-one name="project" column="ProjectID" not-null="true"/>
<property name="name" not-null="true"/>
<property name="format" not-null="true"/>
<property name="prepend" not-null="true"/>
<property name="postpend" not-null="true"/>
<property name="isBound" not-null="true"/>
<property name="isSystem" not-null="true"/>
<set name="boundValues" table="BOUNDVALUES">
<key column="PROPERTY_ID" on-delete="cascade"/>
<element column="BoundValue" type="string"/>
</set>
</joined-subclass>
</hibernate-mapping>
This is the error
Quote:
org.hibernate.MappingException: Could not determine type for: com.rgdsft.hibernate.core.models.DBPropertyType, for columns: [org.hibernate.mapping.Column(PROPERTY_ID)]
Thanks.