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.