Hi,
I have some trouble in reading the Hibernate Doc(Annotation),English isn't my first language.:(
How convert the hbm.xml to anntation
Code:
public class Form implements Serializable{
private Integer id;
private String name;
private Map<String,ValueSet> props;
public void addProps(String propertyName,String strVal,Integer intVal,Boolean bulVal){
if(props == null){
props = new HashMap<String,ValueSet>();
}
ValueSet v = new ValueSet();
v.setBulVal(bulVal);
v.setIntVal(intVal);
v.setStrVal(strVal);
props.put(propertyName, v);
}
public Form() {
}
//setter&getters...
}
ValueSet
Code:
public class ValueSet {
private String strVal;
private Integer intVal;
private Boolean bulVal;
private String propertyType;
//stter&getter...
}
hmb.xml is:
Code:
<!-- DTD.. -->
<hibernate-mapping>
<class name="demo.Form" table="t_form">
<id name="id">
<generator class="native"/>
</id>
<property name="name"/>
<map name="props" >
<key column="fid"/>
<map-key type="string" column="propertyName"></map-key>
<composite-element class="demo.ValueSet">
<property name="strVal" type="string"></property>
<property name="intVal" type="integer"></property>
<property name="bulVal" type="boolean"></property>
</composite-element>
</map>
</class>
</hibernate-mapping>
How convert the hbm.xml to anntation? Thanks a lot!