Skip navigation links

Package com.basho.riak.client.api.annotations

Annotations to use for ORM.

See: Description

Package com.basho.riak.client.api.annotations Description

Annotations to use for ORM.

Introduction

The Riak Java client provides a full set of annotations to facilitate simply storing/retrieving your own domain object. All annotations can be applied to a field or a getter/setter pair of methods.

In addition, the Converter interface allows for serialization/deserialization for the data portion.

By annotating your own domain object, you can simply pass an instance of it to StoreValue.

When fetching data from Riak, the reverse is also true. The FetchValue.Response handles injecting your domain object with any of the annotated values.

Raw types as well as Generic types are supported. The latter is done via Jackson's TypeReferece class.

OverView

To store an object in Riak there's a minimum of four pieces of information required; a bucket type, a bucket name, a key, and a vector clock. For an annotated domain object, only three of these are required as in the absence of a bucket type, the default "default" type is supplied.
 
 public class AnnotatedPojo
 {
      @RiakBucketType
     public String bucketType;

      @RiakBucketName
     public String bucketName;

      @RiakKey
     public String key;

      @RiakVClock
     VClock clock;

     public String value;
 }
 
 
Skip navigation links

Copyright © 2016. All rights reserved.