Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8255081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:24:36+00:00 2026-06-08T01:24:36+00:00

I am storing Person POJOs (4 string fields – id, name, lastUpdate, Data) on

  • 0

I am storing Person POJOs (4 string fields – id, name, lastUpdate, Data) on RIAK, then trying to fetch these objects with MapReduce.

I am doing it very similar to Basho documentation:

    BucketMapReduce m = riakClient.mapReduce("person");
    m.addMapPhase(new NamedJSFunction("Riak.mapByFields"), true);
    MapReduceResult result = m.execute();
    Collection<Person> tmp = result.getResult(Person.class);

the Person’s String constructor is invoked:

public Person(String str){}

(I must have this constructor, otherwise I get an exception for it is missing)
In there I get the object as a String – the Object’s fields in one string with a strange delimiter.

why am I not getting the object automatically converted to my POJO? do I really need to go over the string and deserialize it? am i doing something wrong?s

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T01:24:37+00:00Added an answer on June 8, 2026 at 1:24 am

    The JS function you’re using doesn’t do what you think it does 🙂 It selects objects based on a field with a specific value you have to supply as an argument to the phase.

    I think what you’re looking for is mapValuesJson which will do what you seem to be wanting to do.

    Also, you don’t need a constructor at all in your POJO.

    The code below should point you in the right direction (obviously this is super-simple with all public fields in the POJO and no annotations):

    public class App {
    
        public static void main( String[] args ) throws IOException, RiakException
        {
            IRiakClient client = RiakFactory.httpClient();
            Bucket b = client.fetchBucket("test_mr").execute();
    
            b.store("myobject", new Person()).execute();
            IRiakObject o = b.fetch("myobject").execute();
            System.out.println(o.getValueAsString());
    
    
            BucketMapReduce m = client.mapReduce("test_mr");
            m.addMapPhase(new NamedJSFunction("Riak.mapValuesJson"), true);
            MapReduceResult result = m.execute();
            System.out.println(result.getResultRaw());
            Collection<Person> tmp = result.getResult(Person.class);
    
            for (Person p : tmp)
            {
                System.out.println(p.data);
            }
    
    
            client.shutdown();
        }
    }
    
    class Person 
    {
        public String id = "12345";
        public String name = "my name";
        public String lastUpdate = "some time";
        public String data = "some data";
    
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a data structure Person struct Person { protected: string name; int age;
I have following two simple POJOs: class Person { String name Address address; //and
class Person { string name; public Person(string name) { this.name = name; } public
I have these classes. class Author{ Person person } class Person{ String lastName String
Consider this simple example - public class Person { private String name; private Date
Let's say we have a collection of Person objects class Person { public string
If a collection, like an arraylist, will be storing custom objects (eg Person with
Given: Person[id, name, city, state, country] When am I better off storing city names
Please consider the following code: public class Person ( public string FirstName {get; set;}
So I have the following model: public class Person { public String FirstName {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.