...
An ObjectMappedTable
is a system dataset that can write Java objects to a Table by mapping object fields to Table columns. It can also be explored in an ad-hoc manner.
Creating an ObjectMappedTable
When creating an ObjectMappedTable
in your application, you must specify the Java type that will be stored in your table:
...
Code Block |
---|
(rowkey STRING, catalogid STRING, customer STRING, price INT, product STRING, purchasetime BIGINT, quantity INT) |
Limitations
The record type must be a structured type, that is, a Java class with fields. This is because SQL tables require a structure type at the top level. The fields must be primitives. That is, they must be an int, Integer, float, Float, double, Double, bool, Boolean, String, byte[], or ByteBuffer. UUID is supported and will translate into a binary field.
The record type must be that of an actual Java class, not an interface. The reason is that interfaces only define methods but not fields; hence, reflection would not be able to derive any fields or types from the interface.
Fields of a class that are declared static or transient are ignored during schema generation. This means that the record type must have at least one non-transient and non-static field. For example, the
java.util.Date
class has only static and transient fields. Therefore a record type ofDate
is not supported and will result in an exception when the dataset is created.You cannot insert data into an
ObjectMappedTable
using SQL.
Formulating Queries
When creating your queries, keep these limitations in mind:
...