Thank you Jeremiah. I did find that example, however that is useful when the 
object that you are storing is a string (or so it appears).

There is no capability to store a HashMap as far as I can tell.

I will break down what I am currently doing, which otherwise works great for 
storing an object called "doc" with arbitrary fields:

        IRiakClient riakClient = RiakFactory.pbcClient(host, pbcPort);
        Bucket bucket = riakClient.fetchBucket(bucketName).execute();

        HashMap<String, Object> docHashMap = new HashMap<String, Object>();

        // Add values to docHashMap from "doc" variable here

        String key = hash(doc.getID());
        bucket.store(key, docHashMap).execute();

I have been using this and it has been working well to store the objects and 
they can be fetched in Python (or through the http interface) and they appear 
like dictionaries as expected.

It seems that if I were to follow the example of using RiakObjectBuilder, I 
would need to write an additional custom serializer for the object. If that is 
truly the only way to accomplish this, then that is what I will do. But I would 
imagine that there is a better way to do this.

Are there any other options?

- Jeff


On Apr 8, 2013, at 5:31 PM, Jeremiah Peschka <jeremiah.pesc...@gmail.com> wrote:

> You can find an example of saving indexes here: 
> https://gist.github.com/1368756/6dc57cbdafca75eda3973dafdc1c35e1c4de08eb#file-integtest-java-L133
> 
> Where result is IRiakObject, links can be added via (from the README)
> 
> 
> result.addLink(new RiakLink("otherBucket", "otherKey", "tag"));
> 
> ---
> Jeremiah Peschka - Founder, Brent Ozar Unlimited
> MCITP: SQL Server 2008, MVP
> Cloudera Certified Developer for Apache Hadoop
> 
> 
> On Mon, Apr 8, 2013 at 2:20 PM, Kevin Burton <rkevinbur...@charter.net> wrote:
> I have the same question if you find an answer. I would also like to use a 
> Java client to add links.
> 
> On Apr 8, 2013, at 3:56 PM, Jeff Peck <je...@tnrglobal.com> wrote:
> 
> > Hello,
> >
> > I have been looking through the documentation for an example of how to add 
> > a secondary index in Riak, using the Java client.
> >
> > I am currently storing my object (which is a HashMap) like this:
> >
> > bucket.store(key, docHashMap).execute();
> >
> > What would I need to do to add an index to that object before it gets 
> > stored?
> >
> > Thanks,
> > Jeff
> >
> >
> >
> > _______________________________________________
> > riak-users mailing list
> > riak-users@lists.basho.com
> > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
> 
> _______________________________________________
> riak-users mailing list
> riak-users@lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
> 

_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to