Datastax driver object mapper and union field

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Datastax driver object mapper and union field

Craig Ching
Hi!

We need to implement a union field in our cassandra data model and we're using the datastax Mapper.  Anyone have any recommendations for doing this?  I'm thinking something like:

public class Value {
  int dataType;
  String valueAsString;
  double valueAsDouble;
}

If the Value is a String, do we need to store a double as well (and vice versa)?  Or should we convert the double to a java.lang.Double and null it?  If we did the latter, do we have to worry about tombstones?

Thanks and appreciate any advice!

Cheers,
Craig