I have a Spring/JPA (Hibernate) App that we are trying to be bring Couchbase into for some caching and other functionality. Some of this functionality requires us to pull objects from MySQL and serialize them into Couchbase (JSON). We have some @OneToMany type of scenarios that create circular references for JSON serializers. We already have this problem solved with our own Jackson ObjectMapper for our REST API.
My question is - how do I use our own Jackson ObjectMapper to perform all the serialization/deserialization for for Couchbase. We ARE using extension of CrudRepository, which is making it difficult. I know how to do it if I simply wanted to do key/value or direct N1QL queries, it’s the Repo stuff that is challenging to figure out what is happening under the hood.
We are using a CouchbaseConfig that extends AbstractCouchbaseConfig in our spring app. When the circular reference causes the StackOverflowError, we are seeing the following (repeated):
org.springframework.data.couchbase.core.convert.MappingCouchbaseConverter.access$000(MappingCouchbaseConverter.java:65)
org.springframework.data.couchbase.core.convert.MappingCouchbaseConverter$3.doWithPersistentProperty(MappingCouchbaseConverter.java:442)
org.springframework.data.couchbase.core.convert.MappingCouchbaseConverter$3.doWithPersistentProperty(MappingCouchbaseConverter.java:432)
org.springframework.data.mapping.model.BasicPersistentEntity.doWithProperties(BasicPersistentEntity.java:310)
org.springframework.data.couchbase.core.convert.MappingCouchbaseConverter.writeInternal(MappingCouchbaseConverter.java:432)
org.springframework.data.couchbase.core.convert.MappingCouchbaseConverter.writeInternal(MappingCouchbaseConverter.java:387)
org.springframework.data.couchbase.core.convert.MappingCouchbaseConverter.writeCollectionInternal(MappingCouchbaseConverter.java:590)
org.springframework.data.couchbase.core.convert.MappingCouchbaseConverter.createCollection(MappingCouchbaseConverter.java:566)
org.springframework.data.couchbase.core.convert.MappingCouchbaseConverter.writePropertyInternal(MappingCouchbaseConverter.java:483
I don’t see any indication of Couchbase using Jackson.
Thanks for any help.
Geoff