Hello,
how can I map attributes of a class stored in a
java.util.Map to columns of the same table?
Code:
public class A {
private String id;
private Map attributes = new HashMap();
public String getId() { return this.id;}
protected void setId(String newId) { this.id = newId; }
public Object getProperty(Object name) { return this.attributes.get(name); }
public void setProperty(Object name, Object value) { this.attributes.put(name, value); }
}
For example to a table:
Code:
Person
-------
id varchar(16) (P.K)
firstname varchar2(50)
lastname varchar2(50)
address_id number(6)
<hibernate-mapping>
<class name="A" table="person">
<id name="id" type="string" unsaved-value="null" >
<column name="id" sql-type="VARCHAR" not-null="true"/>
<generator class="uuid.string"/>
</id>
<!-- How do I map the properties here? -->
</class>
</hibernate-mapping>
I read a posting by Gavin that there are plans to support
'generic' code (via HashMaps) and 'typesafe' code (via classes)'.
Thanx for any suggestions.