0
is there any way to persist the map with dymamic fields.Here is sample code
Table :
A table with more than 200 fields.
POJO :
<code>
<pre>
public class DynamicEntity {
private Long id;
private Map<String,String> fields = new HashMap();
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public void add(String key,String value){
fields.put(key,value);
}
}
</pre>
pojo中的地图持有动态字段。 交易代码..
在休眠状态下坚持动态地图
GenericData data = new GenericData();
data.addField("name", "CF");
data.addField("description", "CF-USA");
data.addField("server", "ServerName");
//get the session
session.save(data);
有没有办法在这里保存地图,当我保存POJO呢?下面的字段不HBM文件进行配置,因为所有字段是动态的。
我的基本想法不是在hbm文件中配置200个字段。
Regards,
Ravi.