What does Spring Data Couchbase use the _class field for? -
i'm guessing type used crud operations. used else besides that? i'm wondering impact there configuring how gets populated.
the _class
field written allow polymorphic properties in domain model. see sample:
class wrapper { object inner; } wrapper wrapper = new wrapper(); wrapper.inner = new foo(); couchbaseoperations.save(wrapper);
you see how field inner
foo
serialized , persisted. on reading side of things have find out type create object of , type information in wrapper
not enough states object
.
that's why spring data object mapping persists additional field (name customizable defaulting _class
) store information able inspect source document, derive type value written field , map document particular type.
the spring data couchbase reference documentation doesn't document it, can find information way works in docs mongodb module. i've created a ticket spring data couchbase improve on docs that.
Comments
Post a Comment