0

I have a list of objects that i store in cassandra,

[
  {
     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)"
  }
]

The parent object is

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

I have another attribute deviceUsageParams that is another list of UDT object,

I am trying to store a list of Device object into cassandra, using Kundera wrapper, but it does not allow me to store the List if UDT (i.e list of DeviceUsageParameter)

Is it possible to store a list objects as one of the attribute of another object in a list using kundera wrapper for cassandra?

TIA..

1 Answers1

0

Yes, It is possible to store list of custom objects in Cassandra using Kundera.

You should add @ElementCollection annotation on that field, if you did not already.

Check this test case and object for reference.

HTH!

karthik manchala
  • 13,492
  • 1
  • 31
  • 55