Forum Stats

  • 3,824,920 Users
  • 2,260,440 Discussions
  • 7,896,347 Comments

Discussions

Saving enum name in couchbase from oracle

I am working on spring data couchbase application.In oracle its saving the enum with name but in couchbase its value. I want to save enum name in couchbase instead of its value. But i dont want to change this below existing code. Is there any way to do that? And the enum is not a direct field in document. Its a key value in key value of map of other attribute

public enum Foo {
    Moon("Night"),
    Star("Night"),
    Sun("Day");

    private String value;
    Foo(String value) {
        this.value = value;
    }

    public String getValue() {
        return value;
    }

    @Override
    public String toString() {
        return this.value;
    }


Answers