mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Refactor DbJson Jackson handling adding DatabaseConfig.setJsonDirtyByDefault()
Adds the ability to change the default "jsonDirtyByDefault" configuration setting used with DbJson Jackson properties. Currently these default to being assumed dirty and this allows us to change that to be assumed not dirty (which is very likely the better default).
This commit is contained in:
@@ -193,6 +193,12 @@ public class DatabaseConfig {
|
||||
*/
|
||||
private JsonConfig.Include jsonInclude = JsonConfig.Include.ALL;
|
||||
|
||||
/**
|
||||
* When true then by default DbJson beans are assumed to be dirty.
|
||||
* I believe we want to change this default to false in the future.
|
||||
*/
|
||||
private boolean jsonDirtyByDefault = true;
|
||||
|
||||
/**
|
||||
* The database platform name. Used to imply a DatabasePlatform to use.
|
||||
*/
|
||||
@@ -737,6 +743,26 @@ public class DatabaseConfig {
|
||||
this.jsonInclude = jsonInclude;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if DbJson beans are assumed dirty by default.
|
||||
* <p>
|
||||
* That is, when true beans that do not implement ModifyAwareType are by
|
||||
* default assumed to be dirty and included in updates.
|
||||
*/
|
||||
public boolean isJsonDirtyByDefault() {
|
||||
return jsonDirtyByDefault;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set to false if we want DbJson beans to not be assumed to be dirty.
|
||||
* <p>
|
||||
* That is, when true beans that do not implement ModifyAwareType are by
|
||||
* default assumed to be dirty and included in updates.
|
||||
*/
|
||||
public void setJsonDirtyByDefault(boolean jsonDirtyByDefault) {
|
||||
this.jsonDirtyByDefault = jsonDirtyByDefault;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name of the Database.
|
||||
*/
|
||||
@@ -2909,6 +2935,7 @@ public class DatabaseConfig {
|
||||
jsonInclude = p.getEnum(JsonConfig.Include.class, "jsonInclude", jsonInclude);
|
||||
jsonDateTime = p.getEnum(JsonConfig.DateTime.class, "jsonDateTime", jsonDateTime);
|
||||
jsonDate = p.getEnum(JsonConfig.Date.class, "jsonDate", jsonDate);
|
||||
jsonDirtyByDefault = p.getBoolean("jsonDirtyByDefault", jsonDirtyByDefault);
|
||||
|
||||
runMigration = p.getBoolean("migration.run", runMigration);
|
||||
ddlGenerate = p.getBoolean("ddl.generate", ddlGenerate);
|
||||
@@ -3369,7 +3396,7 @@ public class DatabaseConfig {
|
||||
this.loadModuleInfo = loadModuleInfo;
|
||||
}
|
||||
|
||||
public enum UuidVersion {
|
||||
public enum UuidVersion {
|
||||
VERSION4,
|
||||
VERSION1,
|
||||
VERSION1RND
|
||||
|
||||
Reference in New Issue
Block a user