#1821 - Remove serverConfig updateChangesOnly mode ... as always true

This commit is contained in:
rob bygrave
2019-09-15 21:29:25 +12:00
parent cecf2fc650
commit 3574479627
8 changed files with 3 additions and 95 deletions
@@ -350,11 +350,6 @@ public class ServerConfig {
*/
private DbConstraintNaming constraintNaming = new DbConstraintNaming();
/**
* Behaviour of update to include on the change properties.
*/
private boolean updateChangesOnly = true;
/**
* Behaviour of updates in JDBC batch to by default include all properties.
*/
@@ -2409,20 +2404,6 @@ public class ServerConfig {
this.skipCacheAfterWrite = skipCacheAfterWrite;
}
/**
* Return true to only update changed properties.
*/
public boolean isUpdateChangesOnly() {
return updateChangesOnly;
}
/**
* Set to true to only update changed properties.
*/
public void setUpdateChangesOnly(boolean updateChangesOnly) {
this.updateChangesOnly = updateChangesOnly;
}
/**
* Returns true if updates in JDBC batch default to include all properties by default.
*/
@@ -2966,7 +2947,6 @@ public class ServerConfig {
skipCacheAfterWrite = p.getBoolean("skipCacheAfterWrite", skipCacheAfterWrite);
updateAllPropertiesInBatch = p.getBoolean("updateAllPropertiesInBatch", updateAllPropertiesInBatch);
updateChangesOnly = p.getBoolean("updateChangesOnly", updateChangesOnly);
boolean defaultDeleteMissingChildren = p.getBoolean("defaultDeleteMissingChildren", updatesDeleteMissingChildren);
updatesDeleteMissingChildren = p.getBoolean("updatesDeleteMissingChildren", defaultDeleteMissingChildren);
@@ -1051,16 +1051,6 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
}
}
/**
* Return true if the update DML/SQL must be dynamically generated.
* <p>
* This is the case for updates/deletes of partially populated beans.
* </p>
*/
public boolean isDynamicUpdateSql() {
return beanDescriptor.isUpdateChangesOnly() || !intercept.isFullyLoadedBean();
}
/**
* Return true if the property should be included in the update.
*/
@@ -406,11 +406,6 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType {
private final String baseTableAlias;
/**
* If true then only changed properties get updated.
*/
private final boolean updateChangesOnly;
private final boolean cacheSharableBeans;
private final String docStoreQueueId;
@@ -466,7 +461,6 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType {
this.selectLastInsertedId = deploy.getSelectLastInsertedId();
this.selectLastInsertedIdDraft = deploy.getSelectLastInsertedIdDraft();
this.concurrencyMode = deploy.getConcurrencyMode();
this.updateChangesOnly = deploy.isUpdateChangesOnly();
this.indexDefinitions = deploy.getIndexDefinitions();
this.readAuditing = deploy.isReadAuditing();
@@ -1703,14 +1697,6 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType {
return "update " + baseTable + " set " + prop.importedIdClause() + " where " + idBinder.getBindIdSql(null);
}
/**
* Return true if updates should only include changed properties. Otherwise
* all loaded properties are included in the update.
*/
public boolean isUpdateChangesOnly() {
return updateChangesOnly;
}
/**
* Return true if save does not recurse to other beans. That is return true if
* there are no assoc one or assoc many beans that cascade save.
@@ -144,8 +144,6 @@ public class BeanDescriptorManager implements BeanDescriptorMap {
private int entityBeanCount;
private final boolean updateChangesOnly;
private final BootupClasses bootupClasses;
private final String serverName;
@@ -227,11 +225,7 @@ public class BeanDescriptorManager implements BeanDescriptorMap {
this.deplyInherit = config.getDeployInherit();
this.deployUtil = config.getDeployUtil();
this.typeManager = deployUtil.getTypeManager();
this.beanManagerFactory = new BeanManagerFactory(config.getDatabasePlatform());
this.updateChangesOnly = serverConfig.isUpdateChangesOnly();
this.beanLifecycleAdapterFactory = new BeanLifecycleAdapterFactory(serverConfig);
this.persistControllerManager = new PersistControllerManager(bootupClasses);
this.postLoadManager = new PostLoadManager(bootupClasses);
@@ -1310,9 +1304,6 @@ public class BeanDescriptorManager implements BeanDescriptorMap {
private <T> DeployBeanInfo<T> createDeployBeanInfo(Class<T> beanClass) {
DeployBeanDescriptor<T> desc = new DeployBeanDescriptor<>(this, beanClass, serverConfig);
desc.setUpdateChangesOnly(updateChangesOnly);
beanLifecycleAdapterFactory.addLifecycleMethods(desc);
// set bean controller, finder and listener
@@ -131,8 +131,6 @@ public class DeployBeanDescriptor<T> {
*/
private ConcurrencyMode concurrencyMode;
private boolean updateChangesOnly;
private List<IndexDefinition> indexDefinitions;
private String storageEngine;
@@ -523,14 +521,6 @@ public class DeployBeanDescriptor<T> {
this.concurrencyMode = concurrencyMode;
}
public boolean isUpdateChangesOnly() {
return updateChangesOnly;
}
public void setUpdateChangesOnly(boolean updateChangesOnly) {
this.updateChangesOnly = updateChangesOnly;
}
/**
* Add a compound unique constraint.
*/
@@ -11,7 +11,6 @@ import io.ebean.annotation.Index;
import io.ebean.annotation.InvalidateQueryCache;
import io.ebean.annotation.ReadAudit;
import io.ebean.annotation.StorageEngine;
import io.ebean.annotation.UpdateMode;
import io.ebean.annotation.View;
import io.ebean.config.TableName;
import io.ebeaninternal.server.deploy.BeanDescriptor.EntityType;
@@ -190,11 +189,6 @@ public class AnnotationClass extends AnnotationParser {
descriptor.setDbComment(comment.value());
}
UpdateMode updateMode = findAnnotationRecursive(cls, UpdateMode.class);
if (updateMode != null) {
descriptor.setUpdateChangesOnly(updateMode.updateChangesOnly());
}
if (!disableL2Cache) {
Cache cache = findAnnotationRecursive(cls, Cache.class);
if (cache != null) {
@@ -67,10 +67,8 @@ class MetaFactory {
BindableId id = idFact.createId(desc);
Bindable version = versionFact.create(desc);
Bindable tenantId = versionFact.createTenantId(desc);
BindableList setBindable = new BindableList(setList);
return new UpdateMeta(desc, setBindable, id, version, tenantId);
return new UpdateMeta(setBindable, id, version, tenantId);
}
/**
@@ -20,17 +20,10 @@ import java.util.List;
final class UpdateMeta extends BaseMeta {
private final BindableList set;
private final UpdatePlan modeNoneUpdatePlan;
private final UpdatePlan modeVersionUpdatePlan;
UpdateMeta(BeanDescriptor<?> desc, BindableList set, BindableId id, Bindable version, Bindable tenantId) {
UpdateMeta(BindableList set, BindableId id, Bindable version, Bindable tenantId) {
super(id, version, tenantId);
this.set = set;
String sqlNone = genSql(ConcurrencyMode.NONE, set, desc.getBaseTable());
String sqlVersion = genSql(ConcurrencyMode.VERSION, set, desc.getBaseTable());
this.modeNoneUpdatePlan = new UpdatePlan(ConcurrencyMode.NONE, sqlNone, set);
this.modeVersionUpdatePlan = new UpdatePlan(ConcurrencyMode.VERSION, sqlVersion, set);
}
/**
@@ -56,21 +49,7 @@ final class UpdateMeta extends BaseMeta {
* get or generate the sql based on the concurrency mode.
*/
SpiUpdatePlan getUpdatePlan(PersistRequestBean<?> request) {
if (request.isDynamicUpdateSql()) {
return getDynamicUpdatePlan(request);
}
switch (request.getConcurrencyMode()) {
case NONE:
return modeNoneUpdatePlan;
case VERSION:
return modeVersionUpdatePlan;
default:
throw new RuntimeException("Invalid mode " + request.getConcurrencyMode());
}
return getDynamicUpdatePlan(request);
}
private SpiUpdatePlan getDynamicUpdatePlan(PersistRequestBean<?> persistRequest) {