Guido, I guess that is the other side of the coin. Thank for the tip.
Deepak Bala On Wed, Sep 26, 2012 at 1:51 PM, Guido Medina <guido.med...@temetra.com>wrote: > Deepak, > > That's why in our company we have index annotations at method level, for > us we agreed that an index is not really a POJO property but a > pseudo/computed property, it was a waste for us to add a field just because > an index, so we have our own branch of the Riak java client where the > methods can be annotated as index, I requested this change before but > something stopped it, I do believe indexes are kind of special and could go > on method without need to wait for other annotations to behave the same: > > Then you would just need: > > *@RiakIndex(name="something")** > **@JsonIgnore *// Optional if you want this index to behave like a pseudo > property and not be serialized at all* > *public int getSomething(){ > return someCalculatedInteger; > } > > Here is a link to our branch: > > *git clone https://github.com/guidomedina/riak-java-client.git** > **git checkout temetra-riak-java-client* > *mvn clean install* > > Then on target you will see riak-java-client-1.0.6t.jar > > Best regards, > > Guido > > > On 26/09/12 07:10, Deepak Balasubramanyam wrote: > > I see. All index annotations will need the @JsonProperty annotation to > survive serialization then. I guess another side effect which will break > backward compatibility will be experienced by map-reduce queries on any > entity that contains these indexes. They will not return the indexed value > either since the json value will no longer contain them. Unless of course > you use @JsonProperty. > > Thanks for letting me know about the change. > > Deepak Bala > > On Tue, Sep 25, 2012 at 9:04 PM, Brian Roach <ro...@basho.com> wrote: > >> This is not a bug, it's a feature ;) The fact that the index values >> were were being serialized was actually not consistant with our other >> annotated fields, so I made the decision to bring it in line and not >> do so. >> >> I actually highlighted the change in the CHANGELOG: >> >> af12b6c - The default JSONConverter now supports multiple values via a >> @RiakIndex annotated Set<> (Integer or String). Note this also brings >> serialization/deserialization in line with our other annotaded fields >> in that these values will not be present in the resulting JSON. To >> override this behavior the Jackson @JsonProperty annotation can be >> supplied >> >> Thanks, >> Brian Roach >> >> On Tue, Sep 25, 2012 at 1:01 AM, Deepak Balasubramanyam >> <deepak.b...@gmail.com> wrote: >> > I switched to the java riak-client 1.0.6 to take it for a spin, and >> several >> > test cases of mine failed. Upon further investigation I found that any >> > member variable that contains the @RiakIndex annotation does not >> serialize >> > into Riak anymore. You can reproduce the problem with the following type >> > >> > @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) >> > public class MyType >> > { >> > public static final String SOME_NAME_STR_REFERENCE = "blah"; >> > @RiakKey >> > private String myKey; >> > @RiakIndex(name=SOME_NAME_STR_REFERENCE) >> > private String indexedProp; >> > // Getters and setters go here >> > } >> > >> > Make a call to bucket.store(typeRef).execute() followed by a GET to >> > /riak/myBucket/myKey. The indexedProp element will be missing in the >> json >> > for calls made on riak-client version 1.0.6 but will be available when >> the >> > call is made from riak-client version 1.0.5. >> > >> > Thanks >> > Deepak Bala >> > >> > _______________________________________________ >> > riak-users mailing list >> > riak-users@lists.basho.com >> > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com >> > >> > > > > _______________________________________________ > riak-users mailing > listriak-users@lists.basho.comhttp://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