mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-13 06:42:57 +00:00
#2274 Add DatabaseConfig jsonMutationDetection property setting the global default mode
This commit is contained in:
1 parent
a06f7bea41
commit
2043fdf7e1
5 files changed
+42
-7
No files matched your search
@@ -134,7 +134,7 @@ public final class DefaultTypeManager implements TypeManager {
|
||||
this.postgres = isPostgres(config.getDatabasePlatform());
|
||||
this.objectMapperPresent = config.getClassLoadConfig().isJacksonObjectMapperPresent();
|
||||
this.objectMapper = (objectMapperPresent) ? initObjectMapper(config) : null;
|
||||
this.jsonManager = (objectMapperPresent) ? new TypeJsonManager(postgres, objectMapper) : null;
|
||||
this.jsonManager = (objectMapperPresent) ? new TypeJsonManager(postgres, objectMapper, config.getJsonMutationDetection()) : null;
|
||||
this.extraTypeFactory = new DefaultTypeFactory(config);
|
||||
this.arrayTypeListFactory = arrayTypeListFactory(config.getDatabasePlatform());
|
||||
this.arrayTypeSetFactory = arrayTypeSetFactory(config.getDatabasePlatform());
|
||||
|
||||
+2
-1
@@ -38,7 +38,8 @@ class ScalarTypeJsonObjectMapper {
|
||||
} else if (mode != MutationDetection.DEFAULT) {
|
||||
return new GenericObject(jsonManager, field, dbType, docType);
|
||||
}
|
||||
prop.setMutationDetection(MutationDetection.HASH);
|
||||
// using the global default MutationDetection mode (defaults to HASH)
|
||||
prop.setMutationDetection(jsonManager.mutationDetection());
|
||||
return new GenericObject(jsonManager, field, dbType, docType);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,16 +2,23 @@ package io.ebeaninternal.server.type;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.ebean.ModifyAwareType;
|
||||
import io.ebean.annotation.MutationDetection;
|
||||
import io.ebean.config.dbplatform.DbPlatformType;
|
||||
|
||||
class TypeJsonManager {
|
||||
|
||||
private final boolean postgres;
|
||||
private final ObjectMapper objectMapper;
|
||||
private final MutationDetection mutationDetection;
|
||||
|
||||
TypeJsonManager(boolean postgres, Object objectMapper) {
|
||||
TypeJsonManager(boolean postgres, Object objectMapper, MutationDetection mutationDetection) {
|
||||
this.postgres = postgres;
|
||||
this.objectMapper = (ObjectMapper) objectMapper;
|
||||
this.mutationDetection = mutationDetection;
|
||||
}
|
||||
|
||||
MutationDetection mutationDetection() {
|
||||
return mutationDetection;
|
||||
}
|
||||
|
||||
ObjectMapper objectMapper() {
|
||||
|
||||
Reference in new issue
Block a user