Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Roland Praml
2022-03-16 14:04:20 +01:00
147 changed files with 2859 additions and 2074 deletions
@@ -98,4 +98,14 @@ public class Version<T> {
public Map<String, ValuePair> getDiff() {
return diff;
}
@Override
public String toString() {
return "Version{" +
"bean=" + bean +
", start=" + start +
", end=" + end +
", diff=" + diff +
'}';
}
}
@@ -829,7 +829,7 @@ public final class EntityBeanIntercept implements Serializable {
/**
* Load the bean when it is a reference.
*/
protected void loadBean(int loadProperty) {
void loadBean(int loadProperty) {
lock.lock();
try {
if (beanLoader == null) {
@@ -886,7 +886,7 @@ public final class EntityBeanIntercept implements Serializable {
* Helper method to check if two objects are equal.
*/
@SuppressWarnings({"unchecked", "rawtypes"})
protected static boolean notEqual(Object obj1, Object obj2) {
static boolean notEqual(Object obj1, Object obj2) {
if (obj1 == null) {
return (obj2 != null);
}
@@ -606,13 +606,6 @@ public class DatabasePlatform {
this.useMigrationStoredProcedures = useMigrationStoredProcedures;
}
/**
* Normally not needed - overridden in CockroachPlatform.
*/
public boolean isDdlAutoCommit() {
return false;
}
/**
* Return the DB identity/sequence features for this platform.
*
@@ -18,6 +18,8 @@ public class ClickHousePlatform extends DatabasePlatform {
//this.exceptionTranslator =
this.nativeUuidType = true;
this.dbDefaultValue.setNow("now()");
this.dbDefaultValue.setFalse("0");
this.dbDefaultValue.setTrue("1");
this.dbIdentity.setIdType(IdType.IDENTITY);
this.dbIdentity.setSupportsGetGeneratedKeys(false);
@@ -11,14 +11,7 @@ public class CockroachPlatform extends PostgresPlatform {
public CockroachPlatform() {
super();
this.platform = Platform.COCKROACH;
}
/**
* Needs a commit after create index such that alter table add foreign key ... succeeds.
*/
@Override
public boolean isDdlAutoCommit() {
return false;
this.historySupport = null; // not yet implemented in DDL
}
}
@@ -37,6 +37,7 @@ public abstract class BaseDB2Platform extends DatabasePlatform {
.addDataIntegrity("23502","23503","23504","23511","23512","23511","42917","23515")
.build();
historySupport = new DB2HistorySupport();
booleanDbType = Types.BOOLEAN;
dbTypeMap.put(DbType.TINYINT, new DbPlatformType("smallint", false));
dbTypeMap.put(DbType.INTEGER, new DbPlatformType("integer", false));
@@ -0,0 +1,30 @@
package io.ebean.config.dbplatform.db2;
import io.ebean.config.dbplatform.DbStandardHistorySupport;
/**
* DB2 based history support.
*/
public class DB2HistorySupport extends DbStandardHistorySupport {
@Override
public String getAsOfViewSuffix(String asOfViewSuffix) {
return " for system_time as of ?";
}
@Override
public String getVersionsBetweenSuffix(String asOfViewSuffix) {
return " for system_time between ? and ?";
}
@Override
public String getSysPeriodLower(String tableAlias, String sysPeriod) {
return tableAlias + "." + sysPeriod + "_start";
}
@Override
public String getSysPeriodUpper(String tableAlias, String sysPeriod) {
return tableAlias + "." + sysPeriod + "_end";
}
}
@@ -5,6 +5,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.*;
import java.time.LocalDateTime;
import java.util.Arrays;
/**
@@ -76,7 +77,7 @@ public class H2HistoryTrigger implements Trigger {
public void fire(Connection connection, Object[] oldRow, Object[] newRow) throws SQLException {
if (oldRow != null) {
// a delete or update event
Timestamp now = new Timestamp(System.currentTimeMillis());
LocalDateTime now = LocalDateTime.now();
oldRow[effectEndPosition] = now;
if (newRow != null) {
// update event. Set the effective start timestamp to now.
@@ -92,4 +92,8 @@ public class HanaPlatform extends DatabasePlatform {
}
}
@Override
public boolean isUseMigrationStoredProcedures() {
return true;
}
}
@@ -1,7 +1,6 @@
package io.ebean.plugin;
import java.util.Collection;
import java.util.List;
/**
* General deployment information. This is used in {@link CustomDeployParser}.
@@ -1,7 +1,6 @@
package io.ebean.plugin;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public interface DeployBeanPropertyMeta {