From ff4c3cfbcf2457c2d8790271904a2ffa75f25c71 Mon Sep 17 00:00:00 2001
From: Daniel Gerhardt <code@dgerhardt.net>
Date: Sun, 28 May 2017 15:00:27 +0200
Subject: [PATCH] Only serialize explicitly annotated properties for CouchDB

---
 .../entities/serialization/CouchDbObjectMapperFactory.java     | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/main/java/de/thm/arsnova/entities/serialization/CouchDbObjectMapperFactory.java b/src/main/java/de/thm/arsnova/entities/serialization/CouchDbObjectMapperFactory.java
index 1074cc816..51f822800 100644
--- a/src/main/java/de/thm/arsnova/entities/serialization/CouchDbObjectMapperFactory.java
+++ b/src/main/java/de/thm/arsnova/entities/serialization/CouchDbObjectMapperFactory.java
@@ -17,6 +17,7 @@
  */
 package de.thm.arsnova.entities.serialization;
 
+import com.fasterxml.jackson.databind.MapperFeature;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import org.ektorp.CouchDbConnector;
 import org.ektorp.impl.StdObjectMapperFactory;
@@ -24,6 +25,8 @@ import org.ektorp.impl.StdObjectMapperFactory;
 public class CouchDbObjectMapperFactory extends StdObjectMapperFactory {
 	public ObjectMapper createObjectMapper(CouchDbConnector connector) {
 		ObjectMapper om = super.createObjectMapper(connector);
+		om.configure(MapperFeature.DEFAULT_VIEW_INCLUSION, false);
+		om.setConfig(om.getSerializationConfig().withView(View.Persistence.class));
 		om.registerModule(new CouchDbDocumentModule());
 
 		return om;
-- 
GitLab