Was this page helpful?
ScyllaDB Java Driver is available under the Apache v2 License. ScyllaDB Java Driver is a fork of DataStax Java Driver. See Copyright here.
Java 14 introduced Record as a lightweight, immutable alternative to POJOs. You can map annotated records as entities.
We have a full example at DataStax-Examples/object-mapper-jvm/record.
Note: records are a preview feature of Java 14. As such the mapper’s support for them is also provided as a preview.
Annotate your records like regular classes:
@Entity
record Product(@PartitionKey int id, String description) {}
Records are immutable and use the fluent getter style, but you don’t
need to declare that explicitly with @PropertyStrategy: the mapper detects when it’s processing a
record, and will assume mutable = false, getterStyle = FLUENT
by default.
You need to build with Java 14, and pass the --enable-preview
flag to both the compiler and the
runtime JVM. See pom.xml in the example.
Was this page helpful?
ScyllaDB Java Driver is available under the Apache v2 License. ScyllaDB Java Driver is a fork of DataStax Java Driver. See Copyright here.