I want to store a Riak Pojo object with links in the database using the java. Eventhough the field type is Collection <RiakLink>
, it keep throwing the same exception "riak links field must be Collection <RiakLink>
".
Code: class Pojo{
public String name;
@RiakKey
public String key;
@RiakLinks
@JsonIgnore
public Collection<RiakLink> collection = new ArrayList<RiakLink>();
}
public class Riak2 {
public static void main(String[] args) throws RiakException {
IRiakClient client = RiakFactory.httpClient();
Pojo p = new Pojo();
p.name = "Pojo";
p.key = "First";
p.collection.add(new RiakLink("list","Second","next"));
client.fetchBucket("list").execute().store(p);
}
}
Exception : Exception in thread "main" java.lang.RuntimeException: java.lang.IllegalArgumentException: riak links field must
be Collection <RiakLink>
at com.basho.riak.client.convert.reflect.AnnotationCache.get(AnnotationCache.java:56)
Please give me a help Thanks