2017-10-13 49 views
0

我有存储在卡桑德拉对象的列表的参数之一,不能存储的对象的列表作为父对象的在卡桑德拉使用昆德拉

[ 
    { 
    deviceId: [xxxx], 
    status: On, 
    metric: Metric(Watts=10,Current=10), 
    resources: Resources(cpu=u'2', memory=u'512Mi'), 
    deviceName: ['test'], 
    deviceUsageParams : "Not able to save this param since it is a list of UDT (object)" 
    } 
] 

父对象是

Public static class Device{ 
private int deviceId, 
private boolean status, 
private Metric metric, 
private Resources resources, 
private string deviceName, 
Private List<DeviceUsageParameter> deviceUsageParams 
} 

我有另一个属性deviceUsageParams是UDT对象的另一个列表,

我想存储设备对象列表到卡桑德拉,使用昆德拉包装,但它不允许我如果UDT存储列表(例如DeviceUsageParameter列表)

是否有可能使用cassandra的kundera包装将列表对象作为另一个对象的属性之一存储在列表中?

TIA ..

回答

0

是的,它可以存储使用昆德拉卡桑德拉自定义对象的名单。

如果您还没有,您应该在该字段上添加@ElementCollection注释。

请检查这个test caseobject作为参考。

HTH!