diff --git a/.github/workflows/jdk-ea.yml b/.github/workflows/jdk-ea.yml
index f34c50d76..df2546c9b 100644
--- a/.github/workflows/jdk-ea.yml
+++ b/.github/workflows/jdk-ea.yml
@@ -18,7 +18,7 @@ jobs:
matrix:
## valhalla - failing on javadoc with:
## javadoc: error - The code being documented uses packages in the unnamed module, but the packages defined in https://ebean.io/platforms/ebean-platform-h2/apidocs/ are in named modules.
- java_version: [17,18,19,loom,metropolis,panama]
+ java_version: [GA,EA,loom,metropolis,panama]
os: [ubuntu-latest]
steps:
diff --git a/composites/ebean-clickhouse/pom.xml b/composites/ebean-clickhouse/pom.xml
index 9a9f5c07b..e92270b9c 100644
--- a/composites/ebean-clickhouse/pom.xml
+++ b/composites/ebean-clickhouse/pom.xml
@@ -4,7 +4,7 @@
- * For example, execute a runnable every minute.
- *
- * The delay is the time between executions no matter how long the task took.
- * That is, this method has the same behaviour characteristics as
- * {@link ScheduledExecutorService#scheduleWithFixedDelay(Runnable, long, long, TimeUnit)}
- */
- @Deprecated
- void executePeriodically(Runnable task, long delay, TimeUnit unit);
-
- /**
- * Deprecated - migrate to scheduleWithFixedDelay().
- * Execute a task periodically additionally with an initial delay different from delay.
- */
- @Deprecated
- void executePeriodically(Runnable task, long initialDelay, long delay, TimeUnit unit);
-
/**
* Execute a task periodically with a given delay.
*
diff --git a/ebean-api/src/main/java/io/ebean/FetchConfig.java b/ebean-api/src/main/java/io/ebean/FetchConfig.java
index cfb14a235..1087ff622 100644
--- a/ebean-api/src/main/java/io/ebean/FetchConfig.java
+++ b/ebean-api/src/main/java/io/ebean/FetchConfig.java
@@ -13,8 +13,7 @@ import java.io.Serializable;
* }
*
* Example: Using a "query join" instead of a "fetch join" we instead use 2 SQL queries
- *
+ *
*
- * Construct using default JOIN mode.
- */
- @Deprecated
- public FetchConfig() {
- //this.mode = JOIN_MODE;
- this.batchSize = 100;
- this.hashCode = 1000;
- }
+ private final int mode;
+ private final int batchSize;
+ private final int hashCode;
private FetchConfig(int mode, int batchSize) {
this.mode = mode;
@@ -106,94 +90,6 @@ public final class FetchConfig implements Serializable {
return new FetchConfig(JOIN_MODE, 100);
}
- /**
- * We want to migrate away from mutating FetchConfig to a fully immutable FetchConfig.
- */
- private FetchConfig mutate(int mode, int batchSize) {
- if (batchSize < 0) {
- throw new IllegalArgumentException("batch size " + batchSize + " must be > 0");
- }
- this.mode = mode;
- this.batchSize = batchSize;
- this.hashCode = mode + 10 * batchSize;
- return this;
- }
-
- /**
- * Deprecated - migrate to FetchConfig.ofLazy().
- */
- @Deprecated
- public FetchConfig lazy() {
- return mutate(LAZY_MODE, 0);
- }
-
- /**
- * Deprecated - migrate to FetchConfig.ofLazy(batchSize).
- */
- @Deprecated
- public FetchConfig lazy(int batchSize) {
- return mutate(LAZY_MODE, batchSize);
- }
-
- /**
- * Deprecated - migrate to FetchConfig.ofQuery().
- *
- * Eagerly fetch the beans in this path as a separate query (rather than as
- * part of the main query).
- *
- * This will use the default batch size for separate query which is 100.
- */
- @Deprecated
- public FetchConfig query() {
- return mutate(QUERY_MODE, 100);
- }
-
- /**
- * Deprecated - migrate to FetchConfig.ofQuery(batchSize).
- *
- * Eagerly fetch the beans in this path as a separate query (rather than as
- * part of the main query).
- *
- * The queryBatchSize is the number of parent id's that this separate query
- * will load per batch.
- *
- * This will load all beans on this path eagerly unless a {@link #lazy(int)}
- * is also used.
- *
- * @param batchSize the batch size used to load beans on this path
- */
- @Deprecated
- public FetchConfig query(int batchSize) {
- return mutate(QUERY_MODE, batchSize);
- }
-
- /**
- * Deprecated - migrate to FetchConfig.ofQuery(batchSize).
- *
- * Eagerly fetch the first batch of beans on this path.
- * This is similar to {@link #query(int)} but only fetches the first batch.
- *
- * If there are more parent beans than the batch size then they will not be
- * loaded eagerly but instead use lazy loading.
- *
- * @param batchSize the number of parent beans this path is populated for
- */
- @Deprecated
- public FetchConfig queryFirst(int batchSize) {
- return query(batchSize);
- }
-
- /**
- * Deprecated - migrate to FetchConfig.ofCache().
- *
- * Eagerly fetch the beans fetching the beans from the L2 bean cache
- * and using the DB for beans not in the cache.
- */
- @Deprecated
- public FetchConfig cache() {
- return mutate(CACHE_MODE, 100);
- }
-
/**
* Return the batch size for fetching.
*/
diff --git a/ebean-api/src/main/java/io/ebean/Pairs.java b/ebean-api/src/main/java/io/ebean/Pairs.java
index f0f2fbd62..05da36deb 100644
--- a/ebean-api/src/main/java/io/ebean/Pairs.java
+++ b/ebean-api/src/main/java/io/ebean/Pairs.java
@@ -10,11 +10,10 @@ import java.util.Objects;
*
* This feature is to enable use of L2 cache with complex natural keys with findList() queries in cases where the
* IN clause is not a single property but instead a pair of properties.
- *
* These queries can have predicates that can be translated into a list of complex natural keys such that the L2
* cache can be hit with these keys to obtain some or all of the beans from L2 cache rather than the DB.
- * {@code
*
* // This will use 2 SQL queries to build this object graph
@@ -27,9 +26,6 @@ import java.io.Serializable;
* // query 2) find orderDetails where order.id in (?,?...) // first 100 order id's
*
* }
- *
- * @author mario
- * @author rbygrave
*/
public final class FetchConfig implements Serializable {
@@ -40,21 +36,9 @@ public final class FetchConfig implements Serializable {
private static final int LAZY_MODE = 2;
private static final int CACHE_MODE = 3;
- private int mode;
- private int batchSize;
- private int hashCode;
-
- /**
- * Deprecated - migrate to one of the static factory methods like {@link FetchConfig#ofQuery()}
- * {@code
*
* // where a bean is annotated with a complex
@@ -45,11 +44,10 @@ import java.util.Objects;
* pairs are a unique key/index or part of a unique key/index and highly selective). Currently we know we can do this
* on any DB that supports expression/formula based indexes.
* using a DB string concatenation formula
- *
* This means, the implementation converts the list of pairs into a list of strings via concatenation and we use a * DB concatenation formula to match. We see SQL like: - *
+ * *{@code sql
*
* ...
@@ -60,7 +58,7 @@ import java.util.Objects;
* }
* * We often create a DB expression index to match the DB concat formula like: - *
+ * *{@code sql
*
* create index ix_name on table_name (sku || '-' || code);
@@ -144,14 +142,6 @@ public final class Pairs {
return this;
}
- /**
- * Deprecated migrate to concatSeparator()
- */
- @Deprecated
- public Pairs setConcatSeparator(String concatSeparator) {
- return concatSeparator(concatSeparator);
- }
-
/**
* Return a suffix used with DB varchar concatenation to combine the 2 values.
*/
@@ -167,14 +157,6 @@ public final class Pairs {
return this;
}
- /**
- * Deprecated migrate to concatSuffix()
- */
- @Deprecated
- public Pairs setConcatSuffix(String concatSuffix) {
- return concatSuffix(concatSuffix);
- }
-
@Override
public String toString() {
return "p0:" + property0 + " p1:" + property1 + " entries:" + entries;
diff --git a/ebean-api/src/main/java/io/ebean/Query.java b/ebean-api/src/main/java/io/ebean/Query.java
index 0bc8939f3..400c9775e 100644
--- a/ebean-api/src/main/java/io/ebean/Query.java
+++ b/ebean-api/src/main/java/io/ebean/Query.java
@@ -2,6 +2,7 @@ package io.ebean;
import io.avaje.lang.NonNullApi;
import io.avaje.lang.Nullable;
+
import javax.persistence.NonUniqueResultException;
import java.sql.Connection;
import java.sql.Timestamp;
@@ -1372,18 +1373,9 @@ public interface Query extends CancelableQuery {
* optional asc and desc keywords representing ascending and descending order
* respectively.
*/
- Query order(String orderByClause);
-
- /**
- * Return the OrderBy so that you can append an ascending or descending
- * property to the order by clause.
- *
- * This will never return a null. If no order by clause exists then an 'empty'
- * OrderBy object is returned.
- *
- * This is the same as orderBy()
- */
- OrderBy order();
+ default Query order(String orderByClause) {
+ return orderBy(orderByClause);
+ }
/**
* Return the OrderBy so that you can append an ascending or descending
@@ -1397,15 +1389,30 @@ public interface Query extends CancelableQuery {
OrderBy orderBy();
/**
- * Set an OrderBy object to replace any existing OrderBy clause.
+ * Return the OrderBy so that you can append an ascending or descending
+ * property to the order by clause.
+ *
+ * This will never return a null. If no order by clause exists then an 'empty'
+ * OrderBy object is returned.
+ *
+ * This is the same as orderBy()
*/
- Query setOrder(OrderBy orderBy);
+ default OrderBy order() {
+ return orderBy();
+ }
/**
* Set an OrderBy object to replace any existing OrderBy clause.
*/
Query setOrderBy(OrderBy orderBy);
+ /**
+ * Set an OrderBy object to replace any existing OrderBy clause.
+ */
+ default Query setOrder(OrderBy orderBy) {
+ return setOrderBy(orderBy);
+ }
+
/**
* Set whether this query uses DISTINCT.
*
diff --git a/ebean-api/src/main/java/io/ebean/Transaction.java b/ebean-api/src/main/java/io/ebean/Transaction.java
index 06f6bd315..08c584231 100644
--- a/ebean-api/src/main/java/io/ebean/Transaction.java
+++ b/ebean-api/src/main/java/io/ebean/Transaction.java
@@ -440,14 +440,6 @@ public interface Transaction extends AutoCloseable {
*/
void setGetGeneratedKeys(boolean getGeneratedKeys);
- /**
- * Deprecated renamed to setGetGeneratedKeys().
- */
- @Deprecated
- default void setBatchGetGeneratedKeys(boolean getGeneratedKeys) {
- setGetGeneratedKeys(getGeneratedKeys);
- }
-
/**
* By default when mixing UpdateSql (or CallableSql) with Beans the batch is
* automatically flushed when you change (between persisting beans and
@@ -463,14 +455,6 @@ public interface Transaction extends AutoCloseable {
*/
void setFlushOnMixed(boolean batchFlushOnMixed);
- /**
- * Deprecated renamed to setFlushOnMixed().
- */
- @Deprecated
- default void setBatchFlushOnMixed(boolean batchFlushOnMixed) {
- setFlushOnMixed(batchFlushOnMixed);
- }
-
/**
* By default executing a query will automatically flush any batched
* statements (persisted beans, executed UpdateSql etc).
@@ -480,14 +464,6 @@ public interface Transaction extends AutoCloseable {
*/
void setFlushOnQuery(boolean batchFlushOnQuery);
- /**
- * Deprecated renamed to setFlushOnQuery().
- */
- @Deprecated
- default void setBatchFlushOnQuery(boolean batchFlushOnQuery) {
- setFlushOnQuery(batchFlushOnQuery);
- }
-
/**
* Return true if the batch (of persisted beans or executed UpdateSql etc)
* should be flushed prior to executing a query.
@@ -496,14 +472,6 @@ public interface Transaction extends AutoCloseable {
*/
boolean isFlushOnQuery();
- /**
- * Deprecated renamed to isFlushOnQuery().
- */
- @Deprecated
- default boolean isBatchFlushOnQuery() {
- return isFlushOnQuery();
- }
-
/**
* The batch will be flushing automatically but you can use this to explicitly
* flush the batch if you like.
@@ -519,14 +487,6 @@ public interface Transaction extends AutoCloseable {
*/
void flush() throws PersistenceException;
- /**
- * Deprecated - migrate to flush().
- *
- * flush() is preferred as it matches the JPA flush() method.
- */
- @Deprecated
- void flushBatch() throws PersistenceException;
-
/**
* Return the underlying Connection object.
*
@@ -540,14 +500,6 @@ public interface Transaction extends AutoCloseable {
*/
Connection connection();
- /**
- * Deprecated migrate to connection().
- */
- @Deprecated
- default Connection getConnection() {
- return connection();
- }
-
/**
* Add table modification information to the TransactionEvent.
*
diff --git a/ebean-api/src/main/java/io/ebean/bean/EntityBeanIntercept.java b/ebean-api/src/main/java/io/ebean/bean/EntityBeanIntercept.java
index 888f8f23e..833d7cb31 100644
--- a/ebean-api/src/main/java/io/ebean/bean/EntityBeanIntercept.java
+++ b/ebean-api/src/main/java/io/ebean/bean/EntityBeanIntercept.java
@@ -874,9 +874,6 @@ public final class EntityBeanIntercept implements Serializable {
}
if (lazyLoadProperty == -1) {
lazyLoadProperty = loadProperty;
- if (nodeUsageCollector != null) {
- nodeUsageCollector.setLoadProperty(getProperty(lazyLoadProperty));
- }
loader.loadBean(this);
if (lazyLoadFailure) {
// failed when lazy loading this bean
diff --git a/ebean-api/src/main/java/io/ebean/bean/NodeUsageCollector.java b/ebean-api/src/main/java/io/ebean/bean/NodeUsageCollector.java
index bb65f6735..c168b3a66 100644
--- a/ebean-api/src/main/java/io/ebean/bean/NodeUsageCollector.java
+++ b/ebean-api/src/main/java/io/ebean/bean/NodeUsageCollector.java
@@ -1,6 +1,6 @@
package io.ebean.bean;
-import java.lang.ref.WeakReference;
+import java.lang.ref.Cleaner;
import java.util.LinkedHashSet;
import java.util.Set;
@@ -8,120 +8,102 @@ import java.util.Set;
* Collects profile information for a bean (or reference/proxy bean) at a given node.
*
* The node identifies the location of the bean in the object graph.
- *
- *
- * It has to use a weak reference so as to ensure that it does not stop the
- * associated bean from being garbage collected.
- *
*/
public final class NodeUsageCollector {
- /**
- * The point in the object graph for a specific query and call stack point.
- */
- private final ObjectGraphNode node;
+ private final static Cleaner cleaner = Cleaner.create();
+
+ public static final class State implements Runnable {
+
+ private final NodeUsageListener listener;
+ /**
+ * The properties used at this profile point.
+ */
+ private final Set used = new LinkedHashSet<>();
+ /**
+ * The point in the object graph for a specific query and call stack point.
+ */
+ private final ObjectGraphNode node;
+ /**
+ * set to true if the bean is modified (setter called)
+ */
+ private boolean modified;
+
+ private State(ObjectGraphNode node, NodeUsageListener listener) {
+ this.node = node;
+ this.listener = listener;
+ }
+
+ @Override
+ public String toString() {
+ return node + " read:" + used + " modified:" + modified;
+ }
+
+ @Override
+ public void run() {
+ listener.collectNodeUsage(this);
+ }
+
+ /**
+ * Return true if no properties where used.
+ */
+ public boolean isEmpty() {
+ return used.isEmpty();
+ }
+
+ /**
+ * Return the associated node which identifies the location in the object
+ * graph of the bean/reference.
+ */
+ public ObjectGraphNode node() {
+ return node;
+ }
+
+ /**
+ * Return the set of used properties.
+ */
+ public Set used() {
+ return used;
+ }
+
+ /**
+ * Return true if the bean was modified by a setter.
+ */
+ public boolean isModified() {
+ return modified;
+ }
+ }
+
+ private final State state;
+
+ public NodeUsageCollector(ObjectGraphNode node, NodeUsageListener listener) {
+ this.state = new State(node, listener);
+ cleaner.register(this, state);
+ }
/**
- * Weak to allow garbage collection.
+ * Return the underlying state.
*/
- private final WeakReference managerRef;
-
- /**
- * The properties used at this profile point.
- */
- private final Set used = new LinkedHashSet<>();
-
- /**
- * set to true if the bean is modified (setter called)
- */
- private boolean modified;
-
- /**
- * The property that cause a reference to lazy load.
- */
- private String loadProperty;
-
- public NodeUsageCollector(ObjectGraphNode node, WeakReference managerRef) {
- this.node = node;
- // weak to allow garbage collection.
- this.managerRef = managerRef;
+ public State state() {
+ return state;
}
/**
* The bean has been modified by a setter method.
*/
public void setModified() {
- modified = true;
+ state.modified = true;
}
/**
* Add the name of a property that has been used.
*/
public void addUsed(String property) {
- used.add(property);
- }
-
- /**
- * The property that invoked a lazy load.
- */
- public void setLoadProperty(String loadProperty) {
- this.loadProperty = loadProperty;
- }
-
- /**
- * Publish the usage info to the manager.
- */
- private void publishUsageInfo() {
- NodeUsageListener manager = managerRef.get();
- if (manager != null) {
- manager.collectNodeUsage(this);
- }
- }
-
- /**
- * publish the collected usage information when garbage collection occurs.
- */
- @Override
- protected void finalize() throws Throwable {
- publishUsageInfo();
- super.finalize();
- }
-
- /**
- * Return the associated node which identifies the location in the object
- * graph of the bean/reference.
- */
- public ObjectGraphNode getNode() {
- return node;
- }
-
- /**
- * Return true if no properties where used.
- */
- public boolean isEmpty() {
- return used.isEmpty();
- }
-
- /**
- * Return the set of used properties.
- */
- public Set getUsed() {
- return used;
- }
-
- /**
- * Return true if the bean was modified by a setter.
- */
- public boolean isModified() {
- return modified;
- }
-
- public String getLoadProperty() {
- return loadProperty;
+ state.used.add(property);
}
@Override
public String toString() {
- return node + " read:" + used + " modified:" + modified;
+ return state.toString();
}
}
diff --git a/ebean-api/src/main/java/io/ebean/bean/NodeUsageListener.java b/ebean-api/src/main/java/io/ebean/bean/NodeUsageListener.java
index bfa2c1892..0e4897e90 100644
--- a/ebean-api/src/main/java/io/ebean/bean/NodeUsageListener.java
+++ b/ebean-api/src/main/java/io/ebean/bean/NodeUsageListener.java
@@ -10,7 +10,6 @@ public interface NodeUsageListener {
*
* This is the properties that are used for a given bean in the object graph.
* This information is used by autoTune to tune queries.
- *
*/
- void collectNodeUsage(NodeUsageCollector collector);
+ void collectNodeUsage(NodeUsageCollector.State state);
}
diff --git a/ebean-api/src/main/java/io/ebean/config/DatabaseConfig.java b/ebean-api/src/main/java/io/ebean/config/DatabaseConfig.java
index fdadfdc0f..a9ad4599e 100644
--- a/ebean-api/src/main/java/io/ebean/config/DatabaseConfig.java
+++ b/ebean-api/src/main/java/io/ebean/config/DatabaseConfig.java
@@ -346,11 +346,6 @@ public class DatabaseConfig {
*/
private ClassLoadConfig classLoadConfig = new ClassLoadConfig();
- /**
- * The data source JNDI name if using a JNDI DataSource.
- */
- private String dataSourceJndiName;
-
/**
* The naming convention.
*/
@@ -398,12 +393,12 @@ public class DatabaseConfig {
* Note: It is possible that multiple servers are sharing the same state file as
* long as they are in the same JVM/ClassLoader scope. In this case it is
* recommended to use the same uuidNodeId configuration.
- *
+ *
* If you have multiple servers in different JVMs, do not share the state
* files!
*/
private String uuidNodeId;
-
+
/**
* The clock used for setting the timestamps (e.g. @UpdatedTimestamp) on objects.
*/
@@ -1792,24 +1787,6 @@ public class DatabaseConfig {
this.readOnlyDataSourceConfig = readOnlyDataSourceConfig;
}
- /**
- * Return the JNDI name of the DataSource to use.
- */
- public String getDataSourceJndiName() {
- return dataSourceJndiName;
- }
-
- /**
- * Set the JNDI name of the DataSource to use.
- *
- * By default a prefix of "java:comp/env/jdbc/" is used to lookup the
- * DataSource. This prefix is not used if dataSourceJndiName starts with
- * "java:".
- */
- public void setDataSourceJndiName(String dataSourceJndiName) {
- this.dataSourceJndiName = dataSourceJndiName;
- }
-
/**
* Return a value used to represent TRUE in the database.
*
@@ -2092,14 +2069,14 @@ public class DatabaseConfig {
public void setUuidStateFile(String uuidStateFile) {
this.uuidStateFile = uuidStateFile;
}
-
+
/**
- * Returns the V1-UUID-NodeId
+ * Returns the V1-UUID-NodeId
*/
public String getUuidNodeId() {
return uuidNodeId;
}
-
+
/**
* Sets the V1-UUID-NodeId.
*/
@@ -2979,7 +2956,6 @@ public class DatabaseConfig {
asOfViewSuffix = p.get("asOfViewSuffix", asOfViewSuffix);
asOfSysPeriod = p.get("asOfSysPeriod", asOfSysPeriod);
historyTableSuffix = p.get("historyTableSuffix", historyTableSuffix);
- dataSourceJndiName = p.get("dataSourceJndiName", dataSourceJndiName);
jdbcFetchSizeFindEach = p.getInt("jdbcFetchSizeFindEach", jdbcFetchSizeFindEach);
jdbcFetchSizeFindList = p.getInt("jdbcFetchSizeFindList", jdbcFetchSizeFindList);
databasePlatformName = p.get("databasePlatformName", databasePlatformName);
diff --git a/ebean-api/src/main/java/io/ebean/event/BeanDeleteIdRequest.java b/ebean-api/src/main/java/io/ebean/event/BeanDeleteIdRequest.java
index 66831b69e..876ffaf39 100644
--- a/ebean-api/src/main/java/io/ebean/event/BeanDeleteIdRequest.java
+++ b/ebean-api/src/main/java/io/ebean/event/BeanDeleteIdRequest.java
@@ -1,7 +1,6 @@
package io.ebean.event;
import io.ebean.Database;
-import io.ebean.EbeanServer;
import io.ebean.Transaction;
/**
@@ -9,63 +8,24 @@ import io.ebean.Transaction;
*/
public interface BeanDeleteIdRequest {
- /**
- * Deprecated migrate to database().
- */
- @Deprecated
- EbeanServer getEbeanServer();
-
- /**
- * Deprecated migrate to database().
- */
- @Deprecated
- default Database getDatabase() {
- return getEbeanServer();
- }
-
/**
* Return the DB processing the request.
*/
- default Database database() {
- return getEbeanServer();
- }
+ Database database();
/**
* Return the Transaction associated with this request.
*/
Transaction transaction();
- /**
- * Deprecated migrate to transaction().
- */
- @Deprecated
- default Transaction getTransaction() {
- return transaction();
- }
-
/**
* Returns the bean type of the bean being deleted.
*/
Class> beanType();
- /**
- * Deprecated migrate to beanType().
- */
- @Deprecated
- default Class> getBeanType() {
- return beanType();
- }
-
/**
* Returns the Id value of the bean being deleted.
*/
Object id();
- /**
- * Deprecated migrate to id().
- */
- @Deprecated
- default Object getId() {
- return id();
- }
}
diff --git a/ebean-api/src/main/java/io/ebean/event/BeanPersistRequest.java b/ebean-api/src/main/java/io/ebean/event/BeanPersistRequest.java
index 2f3198b65..eedfa53f4 100644
--- a/ebean-api/src/main/java/io/ebean/event/BeanPersistRequest.java
+++ b/ebean-api/src/main/java/io/ebean/event/BeanPersistRequest.java
@@ -1,7 +1,6 @@
package io.ebean.event;
import io.ebean.Database;
-import io.ebean.EbeanServer;
import io.ebean.Transaction;
import io.ebean.ValuePair;
@@ -20,29 +19,13 @@ public interface BeanPersistRequest {
/**
* Return the DB processing the request.
*/
- default Database database() {
- return getEbeanServer();
- }
-
- /**
- * Deprecated migrate to database().
- */
- @Deprecated
- EbeanServer getEbeanServer();
+ Database database();
/**
* Return the Transaction associated with this request.
*/
Transaction transaction();
- /**
- * Deprecated migrate to transaction().
- */
- @Deprecated
- default Transaction getTransaction() {
- return transaction();
- }
-
/**
* Return true if this request is due to cascading persist.
* False implies this is a "top level" request.
@@ -55,14 +38,6 @@ public interface BeanPersistRequest {
*/
Set loadedProperties();
- /**
- * Deprecated migrate to loadedProperties().
- */
- @Deprecated
- default Set getLoadedProperties() {
- return loadedProperties();
- }
-
/**
* For an update this is the set of properties that where updated.
*
@@ -72,27 +47,11 @@ public interface BeanPersistRequest {
*/
Set updatedProperties();
- /**
- * Deprecated migrate to updatedProperties().
- */
- @Deprecated
- default Set getUpdatedProperties() {
- return updatedProperties();
- }
-
/**
* Flags set for dirty properties (used by ElasticSearch integration).
*/
boolean[] dirtyProperties();
- /**
- * Deprecated migrate to updatedProperties().
- */
- @Deprecated
- default boolean[] getDirtyProperties() {
- return dirtyProperties();
- }
-
/**
* Return true for an update request if at least one of dirty properties is contained
* in the given set of property names.
@@ -115,25 +74,9 @@ public interface BeanPersistRequest {
*/
T bean();
- /**
- * Deprecated migrate to bean().
- */
- @Deprecated
- default T getBean() {
- return bean();
- }
-
/**
* Returns a map of the properties that have changed and their new and old values.
*/
Map updatedValues();
- /**
- * Deprecated migrate to updatedValues().
- */
- @Deprecated
- default Map getUpdatedValues() {
- return updatedValues();
- }
-
}
diff --git a/ebean-api/src/main/java/io/ebean/event/BeanQueryRequest.java b/ebean-api/src/main/java/io/ebean/event/BeanQueryRequest.java
index a8f2b7a29..8ae4fa16a 100644
--- a/ebean-api/src/main/java/io/ebean/event/BeanQueryRequest.java
+++ b/ebean-api/src/main/java/io/ebean/event/BeanQueryRequest.java
@@ -1,7 +1,6 @@
package io.ebean.event;
import io.ebean.Database;
-import io.ebean.EbeanServer;
import io.ebean.Query;
import io.ebean.Transaction;
@@ -13,42 +12,18 @@ public interface BeanQueryRequest {
/**
* Return the DB processing the request.
*/
- default Database database() {
- return getEbeanServer();
- }
-
- /**
- * Deprecated migrate to database().
- */
- @Deprecated
- EbeanServer getEbeanServer();
+ Database database();
/**
* Return the Transaction associated with this request.
*/
Transaction transaction();
- /**
- * Deprecated migrate to transaction().
- */
- @Deprecated
- default Transaction getTransaction() {
- return transaction();
- }
-
/**
* Returns the query.
*/
Query query();
- /**
- * Deprecated migrate to query().
- */
- @Deprecated
- default Query getQuery() {
- return query();
- }
-
/**
* Return true if an Id IN expression should have the bind parameters padded.
*/
diff --git a/ebean-api/src/main/java/io/ebean/event/BulkTableEvent.java b/ebean-api/src/main/java/io/ebean/event/BulkTableEvent.java
index d37743303..a16ec8e3b 100644
--- a/ebean-api/src/main/java/io/ebean/event/BulkTableEvent.java
+++ b/ebean-api/src/main/java/io/ebean/event/BulkTableEvent.java
@@ -10,14 +10,6 @@ public interface BulkTableEvent {
*/
String tableName();
- /**
- * Deprecated migrate to tableName().
- */
- @Deprecated
- default String getTableName() {
- return tableName();
- }
-
/**
* Return true if rows were inserted.
*/
diff --git a/ebean-api/src/main/java/io/ebean/event/ClassUtil.java b/ebean-api/src/main/java/io/ebean/event/ClassUtil.java
index 6f8173d21..72cea3955 100644
--- a/ebean-api/src/main/java/io/ebean/event/ClassUtil.java
+++ b/ebean-api/src/main/java/io/ebean/event/ClassUtil.java
@@ -10,10 +10,9 @@ class ClassUtil {
* Return a new instance of the class using the default constructor.
*/
static Object newInstance(String className) {
-
try {
Class> cls = forName(className);
- return cls.newInstance();
+ return cls.getDeclaredConstructor().newInstance();
} catch (Exception e) {
String msg = "Error constructing " + className;
throw new IllegalArgumentException(msg, e);
@@ -27,7 +26,6 @@ class ClassUtil {
return new ClassLoadContext().forName(name);
}
-
/**
* Helper to wrap the context and caller classLoaders (to use/try both).
*/
@@ -48,7 +46,6 @@ class ClassUtil {
}
public Class> forName(String name) throws ClassNotFoundException {
-
try {
return Class.forName(name, true, contextLoader);
} catch (ClassNotFoundException e) {
@@ -59,7 +56,6 @@ class ClassUtil {
}
}
}
-
}
}
diff --git a/ebean-api/src/main/java/io/ebean/plugin/SpiServer.java b/ebean-api/src/main/java/io/ebean/plugin/SpiServer.java
index 96bf6eed1..f12869b7a 100644
--- a/ebean-api/src/main/java/io/ebean/plugin/SpiServer.java
+++ b/ebean-api/src/main/java/io/ebean/plugin/SpiServer.java
@@ -18,79 +18,31 @@ public interface SpiServer extends Database {
*/
DatabaseConfig config();
- /**
- * Migrate to config().
- */
- @Deprecated
- default DatabaseConfig getServerConfig() {
- return config();
- }
-
/**
* Return the DatabasePlatform for this database.
*/
DatabasePlatform databasePlatform();
- /**
- * Migrate to config().
- */
- @Deprecated
- default DatabasePlatform getDatabasePlatform() {
- return databasePlatform();
- }
-
/**
* Return all the bean types registered on this server instance.
*/
List extends BeanType>> beanTypes();
- /**
- * Migrate to beanTypes().
- */
- @Deprecated
- default List extends BeanType>> getBeanTypes() {
- return beanTypes();
- }
-
/**
* Return the bean type for a given entity bean class.
*/
BeanType beanType(Class beanClass);
- /**
- * Migrate to beanType().
- */
- @Deprecated
- default BeanType getBeanType(Class beanClass) {
- return beanType(beanClass);
- }
-
/**
* Return the bean types mapped to the given base table.
*/
List extends BeanType>> beanTypes(String baseTableName);
- /**
- * Migrate to beanTypes().
- */
- @Deprecated
- default List extends BeanType>> getBeanTypes(String baseTableName) {
- return beanTypes(baseTableName);
- }
-
/**
* Return the bean type for a given doc store queueId.
*/
BeanType> beanTypeForQueueId(String queueId);
- /**
- * Migrate to beanTypes().
- */
- @Deprecated
- default BeanType> getBeanTypeForQueueId(String queueId) {
- return beanTypeForQueueId(queueId);
- }
-
/**
* Return a BeanLoader.
*/
diff --git a/ebean-api/src/main/java/module-info.java b/ebean-api/src/main/java/module-info.java
index c12fe2541..b7fda66b0 100644
--- a/ebean-api/src/main/java/module-info.java
+++ b/ebean-api/src/main/java/module-info.java
@@ -19,6 +19,7 @@ module io.ebean.api {
requires static io.ebean.types;
requires static com.fasterxml.jackson.core;
+ requires static com.fasterxml.jackson.databind;
requires static javax.servlet.api;
exports io.ebean;
diff --git a/ebean-api/src/test/java/io/ebean/bean/NodeUsageCollectorTest.java b/ebean-api/src/test/java/io/ebean/bean/NodeUsageCollectorTest.java
new file mode 100644
index 000000000..103772249
--- /dev/null
+++ b/ebean-api/src/test/java/io/ebean/bean/NodeUsageCollectorTest.java
@@ -0,0 +1,42 @@
+package io.ebean.bean;
+
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+class NodeUsageCollectorTest {
+
+ private final Listener listener = new Listener();
+
+ private final ObjectGraphNode node = new ObjectGraphNode((ObjectGraphOrigin) null, "foo");
+
+ /**
+ * Run this manually as we make use of explicit GC call here which is dubious.
+ */
+ @Disabled
+ @Test
+ void test() throws InterruptedException {
+ NodeUsageCollector c = new NodeUsageCollector(node, listener);
+ c.addUsed("a");
+ c.addUsed("b");
+ c = null;
+
+ System.gc();
+ Thread.sleep(100);
+
+ assertThat(listener.collectCount).isEqualTo(1);
+ assertThat(node).isNotNull();
+ }
+
+ static class Listener implements NodeUsageListener {
+
+ int collectCount;
+
+ @Override
+ public void collectNodeUsage(NodeUsageCollector.State collector) {
+ collectCount++;
+ System.out.println("collectNodeUsage " + collector);
+ }
+ }
+}
diff --git a/ebean-autotune/pom.xml b/ebean-autotune/pom.xml
index e86e0917e..c2ca33791 100644
--- a/ebean-autotune/pom.xml
+++ b/ebean-autotune/pom.xml
@@ -4,7 +4,7 @@
ebean-parent
io.ebean
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
@@ -26,7 +26,7 @@
io.ebean
ebean-core
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
provided
@@ -55,7 +55,7 @@
io.ebean
ebean-platform-h2
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
test
diff --git a/ebean-autotune/src/main/java/io/ebeaninternal/server/autotune/service/ProfileManager.java b/ebean-autotune/src/main/java/io/ebeaninternal/server/autotune/service/ProfileManager.java
index 019955114..24469ee75 100644
--- a/ebean-autotune/src/main/java/io/ebeaninternal/server/autotune/service/ProfileManager.java
+++ b/ebean-autotune/src/main/java/io/ebeaninternal/server/autotune/service/ProfileManager.java
@@ -91,8 +91,8 @@ public class ProfileManager implements ProfilingListener {
* is called on the bean.
*/
@Override
- public void collectNodeUsage(NodeUsageCollector usageCollector) {
- ProfileOrigin profileOrigin = getProfileOrigin(usageCollector.getNode().getOriginQueryPoint());
+ public void collectNodeUsage(NodeUsageCollector.State usageCollector) {
+ ProfileOrigin profileOrigin = getProfileOrigin(usageCollector.node().getOriginQueryPoint());
profileOrigin.collectUsageInfo(usageCollector);
}
diff --git a/ebean-autotune/src/main/java/io/ebeaninternal/server/autotune/service/ProfileOrigin.java b/ebean-autotune/src/main/java/io/ebeaninternal/server/autotune/service/ProfileOrigin.java
index b9935f558..4e2427524 100644
--- a/ebean-autotune/src/main/java/io/ebeaninternal/server/autotune/service/ProfileOrigin.java
+++ b/ebean-autotune/src/main/java/io/ebeaninternal/server/autotune/service/ProfileOrigin.java
@@ -151,9 +151,9 @@ public class ProfileOrigin {
/**
* Collect the usage information for from a instance for this node.
*/
- public void collectUsageInfo(NodeUsageCollector profile) {
+ public void collectUsageInfo(NodeUsageCollector.State profile) {
if (!profile.isEmpty()) {
- getNodeStats(profile.getNode().getPath()).collectUsageInfo(profile);
+ getNodeStats(profile.node().getPath()).collectUsageInfo(profile);
}
}
diff --git a/ebean-autotune/src/main/java/io/ebeaninternal/server/autotune/service/ProfileOriginNodeUsage.java b/ebean-autotune/src/main/java/io/ebeaninternal/server/autotune/service/ProfileOriginNodeUsage.java
index 1f2a655dc..c5a3c17db 100644
--- a/ebean-autotune/src/main/java/io/ebeaninternal/server/autotune/service/ProfileOriginNodeUsage.java
+++ b/ebean-autotune/src/main/java/io/ebeaninternal/server/autotune/service/ProfileOriginNodeUsage.java
@@ -103,11 +103,10 @@ public class ProfileOriginNodeUsage {
/**
* Collect usage from a node.
*/
- protected void collectUsageInfo(NodeUsageCollector profile) {
+ protected void collectUsageInfo(NodeUsageCollector.State profile) {
lock.lock();
try {
- Set used = profile.getUsed();
-
+ Set used = profile.used();
profileCount++;
if (!used.isEmpty()) {
profileUsedCount++;
diff --git a/ebean-autotune/src/test/java/io/ebeaninternal/server/autotune/service/ProfileOriginTest.java b/ebean-autotune/src/test/java/io/ebeaninternal/server/autotune/service/ProfileOriginTest.java
index 9f981a404..371d1976b 100644
--- a/ebean-autotune/src/test/java/io/ebeaninternal/server/autotune/service/ProfileOriginTest.java
+++ b/ebean-autotune/src/test/java/io/ebeaninternal/server/autotune/service/ProfileOriginTest.java
@@ -1,6 +1,7 @@
package io.ebeaninternal.server.autotune.service;
import io.ebean.bean.NodeUsageCollector;
+import io.ebean.bean.NodeUsageListener;
import io.ebean.bean.ObjectGraphNode;
import io.ebean.bean.ObjectGraphOrigin;
import io.ebeaninternal.server.deploy.BeanDescriptor;
@@ -13,6 +14,15 @@ import static org.assertj.core.api.Assertions.assertThat;
public class ProfileOriginTest extends BaseTestCase {
+ static class Noop implements NodeUsageListener {
+ @Override
+ public void collectNodeUsage(NodeUsageCollector.State state) {
+ // do nothing
+ }
+ }
+
+ private final NodeUsageListener listener = new Noop();
+
private final BeanDescriptor desc = getBeanDescriptor(Order.class);
@Test
@@ -23,7 +33,7 @@ public class ProfileOriginTest extends BaseTestCase {
c.addUsed("name");
ProfileOrigin po = new ProfileOrigin(null, false, 1, 1);
- po.collectUsageInfo(c);
+ po.collectUsageInfo(c.state());
OrmQueryDetail detail = po.buildDetail(desc);
@@ -38,11 +48,11 @@ public class ProfileOriginTest extends BaseTestCase {
c.addUsed("name");
ProfileOrigin po = new ProfileOrigin(null, false, 1, 1);
- po.collectUsageInfo(c);
+ po.collectUsageInfo(c.state());
c = node(null);
c.addUsed("orderDate");
- po.collectUsageInfo(c);
+ po.collectUsageInfo(c.state());
OrmQueryDetail detail = po.buildDetail(desc);
@@ -56,11 +66,11 @@ public class ProfileOriginTest extends BaseTestCase {
c.addUsed("id");
ProfileOrigin po = new ProfileOrigin(null, false, 1, 1);
- po.collectUsageInfo(c);
+ po.collectUsageInfo(c.state());
c = node(null);
c.addUsed("orderDate");
- po.collectUsageInfo(c);
+ po.collectUsageInfo(c.state());
OrmQueryDetail detail = po.buildDetail(desc);
@@ -75,15 +85,15 @@ public class ProfileOriginTest extends BaseTestCase {
NodeUsageCollector c = node(null);
c.addUsed("orderDate");
c.addUsed("customer");
- po.collectUsageInfo(c);
+ po.collectUsageInfo(c.state());
c = node("customer");
c.addUsed("billingAddress");
- po.collectUsageInfo(c);
+ po.collectUsageInfo(c.state());
c = node("customer.billingAddress");
c.addUsed("id");
- po.collectUsageInfo(c);
+ po.collectUsageInfo(c.state());
OrmQueryDetail detail = po.buildDetail(desc);
@@ -100,20 +110,20 @@ public class ProfileOriginTest extends BaseTestCase {
NodeUsageCollector c = node(null);
c.addUsed("customer");
- po.collectUsageInfo(c);
+ po.collectUsageInfo(c.state());
c = node("customer");
c.addUsed("id");
c.addUsed("name");
c.addUsed("note");
c.addUsed("billingAddress");
- po.collectUsageInfo(c);
+ po.collectUsageInfo(c.state());
//fetch details.product (id,name)
c = node("customer.billingAddress");
c.addUsed("id");
c.addUsed("line1");
- po.collectUsageInfo(c);
+ po.collectUsageInfo(c.state());
OrmQueryDetail detail = po.buildDetail(desc);
assertThat(detail.asString()).isEqualTo("fetch customer (name,note) fetch customer.billingAddress (line1)");
@@ -121,7 +131,7 @@ public class ProfileOriginTest extends BaseTestCase {
private NodeUsageCollector node(String path) {
ObjectGraphNode node = new ObjectGraphNode((ObjectGraphOrigin)null, path);
- return new NodeUsageCollector(node, null);
+ return new NodeUsageCollector(node, listener);
}
// @Test
diff --git a/ebean-bom/pom.xml b/ebean-bom/pom.xml
index 22b18e87a..6227b2867 100644
--- a/ebean-bom/pom.xml
+++ b/ebean-bom/pom.xml
@@ -4,7 +4,7 @@
ebean-parent
io.ebean
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
ebean bom
@@ -71,94 +71,94 @@
io.ebean
ebean
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
io.ebean
ebean-api
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
io.ebean
ebean-core
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
io.ebean
ebean-core-type
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
io.ebean
ebean-dbmigration-runner
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
io.ebean
ebean-ddl-generator
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
io.ebean
ebean-externalmapping-api
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
io.ebean
ebean-externalmapping-xml
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
io.ebean
ebean-autotune
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
io.ebean
ebean-querybean
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
io.ebean
querybean-generator
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
provided
io.ebean
kotlin-querybean-generator
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
provided
io.ebean
ebean-test
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
test
io.ebean
ebean-postgis
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
io.ebean
ebean-redis
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
diff --git a/ebean-core-type/pom.xml b/ebean-core-type/pom.xml
index 56ee4a06d..39212b229 100644
--- a/ebean-core-type/pom.xml
+++ b/ebean-core-type/pom.xml
@@ -4,7 +4,7 @@
ebean-parent
io.ebean
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
ebean-core-type
@@ -16,7 +16,7 @@
io.ebean
ebean-api
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
diff --git a/ebean-core/pom.xml b/ebean-core/pom.xml
index c2bc96f40..f665ddf37 100644
--- a/ebean-core/pom.xml
+++ b/ebean-core/pom.xml
@@ -3,7 +3,7 @@
ebean-parent
io.ebean
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
ebean-core
@@ -35,19 +35,19 @@
io.ebean
ebean-api
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
io.ebean
ebean-core-type
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
io.ebean
ebean-externalmapping-api
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
@@ -138,21 +138,21 @@
io.ebean
ebean-platform-h2
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
test
io.ebean
ebean-platform-postgres
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
test
io.ebean
ebean-platform-sqlserver
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
test
diff --git a/ebean-core/src/main/java/io/ebeaninternal/api/SpiQuery.java b/ebean-core/src/main/java/io/ebeaninternal/api/SpiQuery.java
index 222f00b9a..ef939a8f5 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/api/SpiQuery.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/api/SpiQuery.java
@@ -391,6 +391,11 @@ public interface SpiQuery extends Query, SpiQueryFetch, TxnProfileEventCod
*/
void incrementAsOfTableCount();
+ /**
+ * Increment the counter of tables used in 'As Of' query.
+ */
+ void incrementAsOfTableCount(int asOfTableCount);
+
/**
* Return the table alias used for the base table.
*/
diff --git a/ebean-core/src/main/java/io/ebeaninternal/api/SpiTransactionProxy.java b/ebean-core/src/main/java/io/ebeaninternal/api/SpiTransactionProxy.java
index c4f81bcab..a46bf033f 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/api/SpiTransactionProxy.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/api/SpiTransactionProxy.java
@@ -312,11 +312,6 @@ public abstract class SpiTransactionProxy implements SpiTransaction {
transaction.flush();
}
- @Override
- public void flushBatch() throws PersistenceException {
- flush();
- }
-
@Override
public Connection connection() {
return transaction.connection();
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/core/BeanRequest.java b/ebean-core/src/main/java/io/ebeaninternal/server/core/BeanRequest.java
index cc900d831..45fe5ff14 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/core/BeanRequest.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/core/BeanRequest.java
@@ -1,6 +1,6 @@
package io.ebeaninternal.server.core;
-import io.ebean.EbeanServer;
+import io.ebean.Database;
import io.ebeaninternal.api.CoreLog;
import io.ebeaninternal.api.SpiEbeanServer;
import io.ebeaninternal.api.SpiTransaction;
@@ -79,7 +79,7 @@ public abstract class BeanRequest {
* Return the server processing the request. Made available for
* BeanController and BeanFinder.
*/
- public EbeanServer getEbeanServer() {
+ public Database database() {
return server;
}
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/core/InitDataSource.java b/ebean-core/src/main/java/io/ebeaninternal/server/core/InitDataSource.java
index 54bfff518..833f00986 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/core/InitDataSource.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/core/InitDataSource.java
@@ -14,7 +14,6 @@ import javax.sql.DataSource;
*/
final class InitDataSource {
- private final JndiDataSourceLookup jndiDataSourceFactory = new JndiDataSourceLookup();
private final DatabaseConfig config;
/**
@@ -41,21 +40,9 @@ final class InitDataSource {
* Initialise the "main" read write DataSource from configuration.
*/
private DataSource initDataSource() {
- final String jndiName = config.getDataSourceJndiName();
- if (jndiName != null) {
- return jndiDataSource(jndiName);
- }
return createFromConfig(config.getDataSourceConfig(), false);
}
- private DataSource jndiDataSource(String jndiName) {
- DataSource ds = jndiDataSourceFactory.lookup(jndiName);
- if (ds == null) {
- throw new PersistenceException("JNDI lookup for DataSource " + jndiName + " returned null.");
- }
- return ds;
- }
-
/**
* Initialise the "read only" DataSource from configuration.
*/
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/core/JndiDataSourceLookup.java b/ebean-core/src/main/java/io/ebeaninternal/server/core/JndiDataSourceLookup.java
deleted file mode 100644
index 09b2f7a9c..000000000
--- a/ebean-core/src/main/java/io/ebeaninternal/server/core/JndiDataSourceLookup.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package io.ebeaninternal.server.core;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.persistence.PersistenceException;
-import javax.sql.DataSource;
-
-/**
- * Helper to lookup a DataSource from JNDI.
- */
-class JndiDataSourceLookup {
-
- /**
- * Return the DataSource by JNDI lookup.
- *
- * If name is null the 'default' dataSource is returned.
- *
- */
- public DataSource lookup(String jndiName) {
- try {
- Context ctx = new InitialContext();
- DataSource ds = (DataSource) ctx.lookup(jndiName);
- if (ds == null) {
- throw new PersistenceException("JNDI DataSource [" + jndiName + "] not found?");
- }
- return ds;
-
- } catch (NamingException ex) {
- throw new PersistenceException(ex);
- }
- }
-}
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/core/bootup/BootupClasses.java b/ebean-core/src/main/java/io/ebeaninternal/server/core/bootup/BootupClasses.java
index ce34e56d2..afa8f6119 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/core/bootup/BootupClasses.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/core/bootup/BootupClasses.java
@@ -94,7 +94,7 @@ public class BootupClasses implements Predicate> {
public void runServerConfigStartup(DatabaseConfig config) {
for (Class> cls : serverConfigStartupCandidates) {
try {
- ServerConfigStartup newInstance = (ServerConfigStartup) cls.newInstance();
+ ServerConfigStartup newInstance = (ServerConfigStartup) cls.getDeclaredConstructor().newInstance();
newInstance.onStart(config);
} catch (Exception e) {
// assume that the desired behavior is to fail - add your own try catch if needed
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/deploy/BeanDescriptorElementEmbedded.java b/ebean-core/src/main/java/io/ebeaninternal/server/deploy/BeanDescriptorElementEmbedded.java
index 70f6eb85c..71d79b9dc 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/deploy/BeanDescriptorElementEmbedded.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/deploy/BeanDescriptorElementEmbedded.java
@@ -22,7 +22,7 @@ class BeanDescriptorElementEmbedded extends BeanDescriptorElement {
BeanDescriptorElementEmbedded(BeanDescriptorMap owner, DeployBeanDescriptor deploy, ElementHelp elementHelp) {
super(owner, deploy, elementHelp);
try {
- this.prototype = (EntityBean) beanType.newInstance();
+ this.prototype = (EntityBean) beanType.getDeclaredConstructor().newInstance();
} catch (Exception e) {
throw new IllegalStateException("Unable to create entity bean prototype for "+beanType);
}
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/deploy/DbSqlContext.java b/ebean-core/src/main/java/io/ebeaninternal/server/deploy/DbSqlContext.java
index 1fccc46f3..ff6839723 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/deploy/DbSqlContext.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/deploy/DbSqlContext.java
@@ -119,6 +119,11 @@ public interface DbSqlContext {
*/
boolean isIncludeSoftDelete();
+ /**
+ * Return the count of history table AS OF predicates added via joins.
+ */
+ int asOfTableCount();
+
/**
* Return true if the query is a 'asDraft' query.
*/
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/executor/DefaultBackgroundExecutor.java b/ebean-core/src/main/java/io/ebeaninternal/server/executor/DefaultBackgroundExecutor.java
index 6e49ff255..b4c13a8bd 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/executor/DefaultBackgroundExecutor.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/executor/DefaultBackgroundExecutor.java
@@ -100,22 +100,11 @@ public final class DefaultBackgroundExecutor implements SpiBackgroundExecutor {
return pool.submit(wrap(task));
}
-
@Override
public void execute(Runnable task) {
submit(logExceptions(task));
}
- @Override
- public void executePeriodically(Runnable task, long delay, TimeUnit unit) {
- schedulePool.scheduleWithFixedDelay(wrap(logExceptions(task)), delay, delay, unit);
- }
-
- @Override
- public void executePeriodically(Runnable task, long initialDelay, long delay, TimeUnit unit) {
- schedulePool.scheduleWithFixedDelay(wrap(logExceptions(task)), initialDelay, delay, unit);
- }
-
@Override
public ScheduledFuture> scheduleWithFixedDelay(Runnable task, long initialDelay, long delay, TimeUnit unit) {
return schedulePool.scheduleWithFixedDelay(wrap(logExceptions(task)), initialDelay, delay, unit);
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/persist/DeleteIdRequest.java b/ebean-core/src/main/java/io/ebeaninternal/server/persist/DeleteIdRequest.java
index 714744d36..0409af64d 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/persist/DeleteIdRequest.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/persist/DeleteIdRequest.java
@@ -1,15 +1,15 @@
package io.ebeaninternal.server.persist;
-import io.ebean.EbeanServer;
+import io.ebean.Database;
import io.ebean.Transaction;
import io.ebean.event.BeanDeleteIdRequest;
import io.ebeaninternal.api.SpiEbeanServer;
final class DeleteIdRequest implements BeanDeleteIdRequest {
- private final EbeanServer server;
+ private final SpiEbeanServer server;
private final Transaction transaction;
- private Class> beanType;
+ private final Class> beanType;
private Object id;
DeleteIdRequest(SpiEbeanServer server, Transaction transaction, Class> beanType, Object id) {
@@ -24,7 +24,7 @@ final class DeleteIdRequest implements BeanDeleteIdRequest {
}
@Override
- public EbeanServer getEbeanServer() {
+ public Database database() {
return server;
}
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/query/CQuery.java b/ebean-core/src/main/java/io/ebeaninternal/server/query/CQuery.java
index 22e2e1f37..3566ee08a 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/query/CQuery.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/query/CQuery.java
@@ -18,7 +18,6 @@ import io.ebeaninternal.server.core.SpiOrmQueryRequest;
import io.ebeaninternal.server.deploy.*;
import javax.persistence.PersistenceException;
-import java.lang.ref.WeakReference;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@@ -149,8 +148,6 @@ public final class CQuery implements DbReadContext, CancelableQuery, SpiProfi
private final ProfilingListener profilingListener;
- private final WeakReference profilingListenerRef;
-
private final Boolean readOnly;
private long profileOffset;
@@ -189,7 +186,6 @@ public final class CQuery implements DbReadContext, CancelableQuery, SpiProfi
this.objectGraphNode = query.getParentNode();
this.profilingListener = query.getProfilingListener();
this.autoTuneProfiling = profilingListener != null;
- this.profilingListenerRef = autoTuneProfiling ? new WeakReference<>(profilingListener) : null;
// set the generated sql back to the query
// so its available to the user...
query.setGeneratedSql(queryPlan.getSql());
@@ -673,7 +669,7 @@ public final class CQuery implements DbReadContext, CancelableQuery, SpiProfi
@Override
public void profileBean(EntityBeanIntercept ebi, String prefix) {
ObjectGraphNode node = request.loadContext().getObjectGraphNode(prefix);
- ebi.setNodeUsageCollector(new NodeUsageCollector(node, profilingListenerRef));
+ ebi.setNodeUsageCollector(new NodeUsageCollector(node, profilingListener));
}
@Override
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/query/CQueryBuilder.java b/ebean-core/src/main/java/io/ebeaninternal/server/query/CQueryBuilder.java
index 77dc2b1e6..b32492cec 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/query/CQueryBuilder.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/query/CQueryBuilder.java
@@ -644,9 +644,12 @@ final class CQueryBuilder {
}
private void appendHistoryAsOfPredicate() {
- if (query.isAsOfBaseTable() && !historySupport.isStandardsBased()) {
- appendAndOrWhere();
- sb.append(historySupport.getAsOfPredicate(request.baseTableAlias()));
+ if (query.isAsOfBaseTable()) {
+ query.incrementAsOfTableCount();
+ if (!historySupport.isStandardsBased()){
+ appendAndOrWhere();
+ sb.append(historySupport.getAsOfPredicate(request.baseTableAlias()));
+ }
}
}
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/query/DefaultDbSqlContext.java b/ebean-core/src/main/java/io/ebeaninternal/server/query/DefaultDbSqlContext.java
index 4e45c564c..63fa76d92 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/query/DefaultDbSqlContext.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/query/DefaultDbSqlContext.java
@@ -18,45 +18,27 @@ final class DefaultDbSqlContext implements DbSqlContext {
private static final String tableAliasManyPlaceHolder = "${mta}";
private final String columnAliasPrefix;
-
private final ArrayStack tableAliasStack = new ArrayStack<>();
-
private final ArrayStack joinStack = new ArrayStack<>();
-
private final ArrayStack prefixStack = new ArrayStack<>();
-
private final String fromForUpdate;
-
private boolean useColumnAlias;
-
private int columnIndex;
-
+ private int asOfTableCount;
private StringBuilder sb = new StringBuilder(STRING_BUILDER_INITIAL_CAPACITY);
-
/**
* A Set used to make sure formula joins are only added once to a query.
*/
private HashSet formulaJoins;
-
private HashSet tableJoins;
-
private final SqlTreeAlias alias;
-
private String currentPrefix;
-
private List encryptedProps;
-
private List extraJoins;
-
private final CQueryDraftSupport draftSupport;
-
private final CQueryHistorySupport historySupport;
-
private final boolean historyQuery;
- /**
- * Construct for SELECT clause (with column alias settings).
- */
DefaultDbSqlContext(SqlTreeAlias alias, String columnAliasPrefix, CQueryHistorySupport historySupport,
CQueryDraftSupport draftSupport, String fromForUpdate) {
this.alias = alias;
@@ -116,7 +98,6 @@ final class DefaultDbSqlContext implements DbSqlContext {
if (encryptedProps == null) {
return null;
}
-
return encryptedProps.toArray(new BeanProperty[0]);
}
@@ -153,6 +134,9 @@ final class DefaultDbSqlContext implements DbSqlContext {
String asOfView = historySupport.getAsOfView(table);
appendTable(table, asOfView);
if (asOfView != null) {
+ if (historySupport.isStandardsBased()) {
+ asOfTableCount++;
+ }
addAsOfOnClause = !historySupport.isStandardsBased();
}
}
@@ -178,6 +162,7 @@ final class DefaultDbSqlContext implements DbSqlContext {
}
if (addAsOfOnClause) {
sb.append(" and ").append(historySupport.getAsOfPredicate(a2));
+ asOfTableCount++;
}
if (extraWhere != null && !extraWhere.isEmpty()) {
sb.append(" and ");
@@ -195,6 +180,11 @@ final class DefaultDbSqlContext implements DbSqlContext {
}
}
+ @Override
+ public int asOfTableCount() {
+ return asOfTableCount;
+ }
+
@Override
public boolean isDraftQuery() {
return draftSupport != null;
@@ -236,7 +226,7 @@ final class DefaultDbSqlContext implements DbSqlContext {
@Override
public void appendFormulaJoin(String sqlFormulaJoin, SqlJoinType joinType, String manyWhere) {
- // replace ${ta} place holder with the real table alias...
+ // replace ${ta} placeholder with the real table alias...
String tableAlias = manyWhere == null ? tableAliasStack.peek() : getTableAliasManyWhere(manyWhere);
String converted = sqlFormulaJoin.replace(tableAliasPlaceHolder, tableAlias);
if (formulaJoins == null) {
@@ -250,9 +240,9 @@ final class DefaultDbSqlContext implements DbSqlContext {
formulaJoins.add(converted);
sb.append(" ");
if (joinType == SqlJoinType.OUTER) {
- if ("join".equals(sqlFormulaJoin.substring(0, 4).toLowerCase())) {
+ if ("join".equalsIgnoreCase(sqlFormulaJoin.substring(0, 4))) {
// prepend left as we are in the 'many' part
- append(" left ");
+ sb.append("left ");
}
}
sb.append(converted);
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/query/DefaultFetchGroupQuery.java b/ebean-core/src/main/java/io/ebeaninternal/server/query/DefaultFetchGroupQuery.java
index da8caf0b1..fbc791937 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/query/DefaultFetchGroupQuery.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/query/DefaultFetchGroupQuery.java
@@ -432,26 +432,11 @@ final class DefaultFetchGroupQuery implements SpiFetchGroupQuery, SpiQuery
throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
}
- @Override
- public Query order(String orderByClause) {
- throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
- }
-
- @Override
- public OrderBy order() {
- throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
- }
-
@Override
public OrderBy orderBy() {
throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
}
- @Override
- public Query setOrder(OrderBy orderBy) {
- throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
- }
-
@Override
public Query setOrderBy(OrderBy orderBy) {
throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/query/SqlTreeBuilder.java b/ebean-core/src/main/java/io/ebeaninternal/server/query/SqlTreeBuilder.java
index c0142ddbc..672e5acff 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/query/SqlTreeBuilder.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/query/SqlTreeBuilder.java
@@ -127,6 +127,7 @@ public final class SqlTreeBuilder {
groupBy = buildGroupByClause();
distinctOn = buildDistinctOn();
encryptedProps = ctx.getEncryptedProps();
+ query.incrementAsOfTableCount(ctx.asOfTableCount());
}
boolean includeJoins = alias != null && alias.isIncludeJoins();
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/query/SqlTreeNodeBean.java b/ebean-core/src/main/java/io/ebeaninternal/server/query/SqlTreeNodeBean.java
index 1ed4df10d..621820862 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/query/SqlTreeNodeBean.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/query/SqlTreeNodeBean.java
@@ -302,20 +302,7 @@ class SqlTreeNodeBean implements SqlTreeNode {
@Override
public void addAsOfTableAlias(SpiQuery> query) {
- // if history on this bean type add it's alias
- // for each alias we add an effect date predicate
- if (desc.isHistorySupport()) {
- query.incrementAsOfTableCount();
- }
- if (lazyLoadParent != null && lazyLoadParent.isManyToManyWithHistory()) {
- query.incrementAsOfTableCount();
- }
- if (intersectionAsOfTableAlias) {
- query.incrementAsOfTableCount();
- }
- for (SqlTreeNode child : children) {
- child.addAsOfTableAlias(query);
- }
+ // do nothing for non-root, handled by DbSqlContext for joins
}
@Override
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/query/SqlTreeNodeRoot.java b/ebean-core/src/main/java/io/ebeaninternal/server/query/SqlTreeNodeRoot.java
index c25024624..be58c1938 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/query/SqlTreeNodeRoot.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/query/SqlTreeNodeRoot.java
@@ -58,13 +58,6 @@ final class SqlTreeNodeRoot extends SqlTreeNodeBean {
public void addAsOfTableAlias(SpiQuery> query) {
if (desc.isHistorySupport()) {
query.setAsOfBaseTable();
- query.incrementAsOfTableCount();
- }
- if (lazyLoadParent != null && lazyLoadParent.isManyToManyWithHistory()) {
- query.incrementAsOfTableCount();
- }
- for (SqlTreeNode aChildren : children) {
- aChildren.addAsOfTableAlias(query);
}
}
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/querydefn/DefaultOrmQuery.java b/ebean-core/src/main/java/io/ebeaninternal/server/querydefn/DefaultOrmQuery.java
index 6aa0f9a6a..1736618dc 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/querydefn/DefaultOrmQuery.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/querydefn/DefaultOrmQuery.java
@@ -316,6 +316,11 @@ public final class DefaultOrmQuery extends AbstractQuery implements SpiQuery<
asOfTableCount++;
}
+ @Override
+ public void incrementAsOfTableCount(int increment) {
+ asOfTableCount += increment;
+ }
+
@Override
public int getAsOfTableCount() {
return asOfTableCount;
@@ -1608,13 +1613,7 @@ public final class DefaultOrmQuery extends AbstractQuery implements SpiQuery<
}
@Override
- @Deprecated
public OrderBy orderBy() {
- return order();
- }
-
- @Override
- public OrderBy order() {
if (orderBy == null) {
orderBy = new OrderBy<>(this, null);
}
@@ -1622,13 +1621,7 @@ public final class DefaultOrmQuery extends AbstractQuery implements SpiQuery<
}
@Override
- @Deprecated
public Query orderBy(String orderByClause) {
- return order(orderByClause);
- }
-
- @Override
- public Query order(String orderByClause) {
if (orderByClause == null || orderByClause.trim().isEmpty()) {
this.orderBy = null;
} else {
@@ -1638,13 +1631,7 @@ public final class DefaultOrmQuery extends AbstractQuery implements SpiQuery<
}
@Override
- @Deprecated
public Query setOrderBy(OrderBy orderBy) {
- return setOrder(orderBy);
- }
-
- @Override
- public Query setOrder(OrderBy orderBy) {
this.orderBy = orderBy;
if (orderBy != null) {
orderBy.setQuery(this);
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/transaction/ImplicitReadOnlyTransaction.java b/ebean-core/src/main/java/io/ebeaninternal/server/transaction/ImplicitReadOnlyTransaction.java
index 316e2f8b8..42f585707 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/transaction/ImplicitReadOnlyTransaction.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/transaction/ImplicitReadOnlyTransaction.java
@@ -378,19 +378,12 @@ final class ImplicitReadOnlyTransaction implements SpiTransaction, TxnProfileEve
/**
* Flush any queued persist requests.
*
- * This is general will result in a number of batched PreparedStatements
- * executing.
- *
+ * This is general will result in a number of batched PreparedStatements executing.
*/
@Override
public void flush() {
}
- @Override
- public void flushBatch() {
- flush();
- }
-
/**
* Return the persistence context associated with this transaction.
*/
@@ -405,7 +398,6 @@ final class ImplicitReadOnlyTransaction implements SpiTransaction, TxnProfileEve
* This could be considered similar to EJB3 Extended PersistanceContext. In
* that you get the PersistanceContext from a transaction, hold onto it, and
* then set it back later to a second transaction.
- *
*/
@Override
public void setPersistenceContext(SpiPersistenceContext context) {
@@ -503,7 +495,6 @@ final class ImplicitReadOnlyTransaction implements SpiTransaction, TxnProfileEve
*
* This leaves the transaction active and expects another commit
* to occur later (which closes the underlying connection etc).
- *
*/
@Override
public void commitAndContinue() {
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/transaction/JdbcTransaction.java b/ebean-core/src/main/java/io/ebeaninternal/server/transaction/JdbcTransaction.java
index 71201629a..89761e809 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/transaction/JdbcTransaction.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/transaction/JdbcTransaction.java
@@ -758,11 +758,6 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
internalBatchFlush();
}
- @Override
- public final void flushBatch() {
- flush();
- }
-
/**
* Flush the JDBC batch and execute derived relationship statements if necessary.
*/
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/transaction/JtaTransactionManager.java b/ebean-core/src/main/java/io/ebeaninternal/server/transaction/JtaTransactionManager.java
index 413c79cbc..f5edf2688 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/transaction/JtaTransactionManager.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/transaction/JtaTransactionManager.java
@@ -27,7 +27,7 @@ public final class JtaTransactionManager implements ExternalTransactionManager {
private TransactionScopeManager scope;
/**
- * Instantiates a new spring aware transaction scope manager.
+ * Instantiates a new JTA transaction manager.
*/
public JtaTransactionManager() {
}
@@ -37,10 +37,8 @@ public final class JtaTransactionManager implements ExternalTransactionManager {
*/
@Override
public void setTransactionManager(Object txnMgr) {
-
// RB: At this stage not exposing TransactionManager to
// the public API and hence the Object type and casting here
-
this.transactionManager = (TransactionManager) txnMgr;
this.scope = transactionManager.scope();
}
@@ -72,16 +70,13 @@ public final class JtaTransactionManager implements ExternalTransactionManager {
}
/**
- * Looks for a current Spring managed transaction and wraps/returns that as a Ebean transaction.
+ * Looks for a current JTA managed transaction and wraps/returns that as an Ebean transaction.
*
* Returns null if there is no current spring transaction (lazy loading outside a spring txn etc).
- *
*/
@Override
public Object getCurrentTransaction() {
-
TransactionSynchronizationRegistry syncRegistry = getSyncRegistry();
-
SpiTransaction t = (SpiTransaction) syncRegistry.getResource(EBEAN_TXN_RESOURCE);
if (t != null) {
// we have already seen this transaction
@@ -122,14 +117,10 @@ public final class JtaTransactionManager implements ExternalTransactionManager {
return newTrans;
}
-
/**
- * Create a listener to register with JTA to enable Ebean to be
- * notified when transactions commit and rollback.
+ * Create a listener to register with JTA to enable Ebean to be notified when transactions commit and rollback.
*
- * This is used by Ebean to notify it's appropriate listeners and maintain it's server
- * cache etc.
- *
+ * This is used by Ebean to notify its appropriate listeners and maintain its server cache etc.
*/
private JtaTxnListener createJtaTxnListener(SpiTransaction t) {
return new JtaTxnListener(transactionManager, t);
@@ -169,7 +160,6 @@ public final class JtaTransactionManager implements ExternalTransactionManager {
*
* When Ebean is notified (of the commit/rollback) it can then manage its
* cache, notify BeanPersistListeners etc.
- *
*/
private static class JtaTxnListener implements Synchronization {
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/transaction/NoTransaction.java b/ebean-core/src/main/java/io/ebeaninternal/server/transaction/NoTransaction.java
index 9c043dfe9..529a7ca0a 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/transaction/NoTransaction.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/transaction/NoTransaction.java
@@ -283,10 +283,6 @@ final class NoTransaction implements SpiTransaction {
public void flush() throws PersistenceException {
}
- @Override
- public void flushBatch() throws PersistenceException {
- }
-
@Override
public Connection connection() {
return null;
diff --git a/ebean-core/src/test/java/io/ebeaninternal/server/core/InitDataSourceTest.java b/ebean-core/src/test/java/io/ebeaninternal/server/core/InitDataSourceTest.java
index 89fb432f6..b6a11a959 100644
--- a/ebean-core/src/test/java/io/ebeaninternal/server/core/InitDataSourceTest.java
+++ b/ebean-core/src/test/java/io/ebeaninternal/server/core/InitDataSourceTest.java
@@ -3,7 +3,7 @@ package io.ebeaninternal.server.core;
import io.ebean.config.DatabaseConfig;
import io.ebean.datasource.DataSourceAlert;
import io.ebean.datasource.DataSourceConfig;
-import io.ebean.datasource.pool.ConnectionPool;
+import io.ebean.datasource.DataSourcePool;
import org.junit.jupiter.api.Test;
import javax.sql.DataSource;
@@ -137,7 +137,7 @@ public class InitDataSourceTest {
config.getDataSourceConfig().setUrl("jdbc:h2:mem:dsTestOnline");
config.getDataSourceConfig().setDriver("org.h2.Driver");
InitDataSource.init(config);
- ConnectionPool pool = (ConnectionPool) config.getDataSource();
+ DataSourcePool pool = (DataSourcePool) config.getDataSource();
assertThat(pool.isDataSourceUp()).isTrue();
pool.shutdown();
}
@@ -174,7 +174,7 @@ public class InitDataSourceTest {
config.getDataSourceConfig().setAlert(alert);
config.setDatabasePlatformName("h2");
InitDataSource.init(config);
- ConnectionPool pool = (ConnectionPool) config.getDataSource();
+ DataSourcePool pool = (DataSourcePool) config.getDataSource();
assertThat(pool).isNotNull();
// make some additional tests with the pool
assertThat(pool.isDataSourceUp()).isFalse();
diff --git a/ebean-core/src/test/java/io/ebeaninternal/server/expression/BaseExpressionTest.java b/ebean-core/src/test/java/io/ebeaninternal/server/expression/BaseExpressionTest.java
index b66c1da62..1e782f4eb 100644
--- a/ebean-core/src/test/java/io/ebeaninternal/server/expression/BaseExpressionTest.java
+++ b/ebean-core/src/test/java/io/ebeaninternal/server/expression/BaseExpressionTest.java
@@ -1,6 +1,6 @@
package io.ebeaninternal.server.expression;
-import io.ebean.EbeanServer;
+import io.ebean.Database;
import io.ebean.Query;
import io.ebean.Transaction;
import io.ebean.event.BeanQueryRequest;
@@ -62,7 +62,7 @@ public abstract class BaseExpressionTest extends BaseTest {
}
@Override
- public EbeanServer getEbeanServer() {
+ public Database database() {
return null;
}
diff --git a/ebean-dbmigration-runner/pom.xml b/ebean-dbmigration-runner/pom.xml
index 9509b7b29..c0ba5240c 100644
--- a/ebean-dbmigration-runner/pom.xml
+++ b/ebean-dbmigration-runner/pom.xml
@@ -4,7 +4,7 @@
ebean-parent
io.ebean
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
ebean dbmigration runner
@@ -29,7 +29,7 @@
io.ebean
ebean-core
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
provided
diff --git a/ebean-ddl-generator/pom.xml b/ebean-ddl-generator/pom.xml
index 5bb3a0852..6ec1ef377 100644
--- a/ebean-ddl-generator/pom.xml
+++ b/ebean-ddl-generator/pom.xml
@@ -4,7 +4,7 @@
ebean-parent
io.ebean
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
ebean ddl generation
@@ -28,14 +28,14 @@
io.ebean
ebean-core-type
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
provided
io.ebean
ebean-core
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
provided
@@ -58,14 +58,14 @@
io.ebean
ebean-dbmigration-runner
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
test
io.ebean
ebean-platform-all
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
test
diff --git a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/model/MTable.java b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/model/MTable.java
index 96cd1b494..b9abb5116 100644
--- a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/model/MTable.java
+++ b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/model/MTable.java
@@ -1,36 +1,12 @@
package io.ebeaninternal.dbmigration.model;
import io.ebeaninternal.dbmigration.ddlgeneration.platform.DdlHelp;
-import io.ebeaninternal.dbmigration.migration.AddColumn;
-import io.ebeaninternal.dbmigration.migration.AddHistoryTable;
-import io.ebeaninternal.dbmigration.migration.AddTableComment;
-import io.ebeaninternal.dbmigration.migration.AlterColumn;
-import io.ebeaninternal.dbmigration.migration.AlterTable;
-import io.ebeaninternal.dbmigration.migration.Column;
-import io.ebeaninternal.dbmigration.migration.CreateTable;
-import io.ebeaninternal.dbmigration.migration.DropColumn;
-import io.ebeaninternal.dbmigration.migration.DropHistoryTable;
-import io.ebeaninternal.dbmigration.migration.DropTable;
-import io.ebeaninternal.dbmigration.migration.ForeignKey;
-import io.ebeaninternal.dbmigration.migration.RenameColumn;
-import io.ebeaninternal.dbmigration.migration.UniqueConstraint;
-import io.ebeaninternal.server.deploy.BeanDescriptor;
-import io.ebeaninternal.server.deploy.BeanProperty;
-import io.ebeaninternal.server.deploy.IdentityMode;
-import io.ebeaninternal.server.deploy.PartitionMeta;
-import io.ebeaninternal.server.deploy.TablespaceMeta;
-
+import io.ebeaninternal.dbmigration.migration.*;
+import io.ebeaninternal.server.deploy.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
+import java.util.*;
import static io.ebeaninternal.dbmigration.ddlgeneration.platform.SplitColumns.split;
import static io.ebeaninternal.dbmigration.model.MTableIdentity.fromCreateTable;
@@ -110,8 +86,7 @@ public class MTable {
/**
* Constructor for test cases only!
*/
- @Deprecated
- public MTable(String name) {
+ MTable(String name) {
this(name, null, null);
}
@@ -121,7 +96,7 @@ public class MTable {
public MTable(String name, BeanDescriptor> descriptor) {
this(name, descriptor.tablespaceMeta(), descriptor.storageEngine());
}
-
+
/**
* Constructor for dependant tables (draft/element collection or intersection).
*/
@@ -161,8 +136,8 @@ public class MTable {
this.storageEngine = createTable.getStorageEngine();
if (createTable.getTablespace() != null) {
this.tablespaceMeta = new TablespaceMeta(createTable.getTablespace(),
- createTable.getIndexTablespace() != null ? createTable.getIndexTablespace() : createTable.getTablespace(),
- createTable.getLobTablespace() != null ? createTable.getLobTablespace() : createTable.getTablespace());
+ createTable.getIndexTablespace() != null ? createTable.getIndexTablespace() : createTable.getTablespace(),
+ createTable.getLobTablespace() != null ? createTable.getLobTablespace() : createTable.getTablespace());
} else {
this.tablespaceMeta = null;
}
@@ -296,7 +271,7 @@ public class MTable {
compareCompoundKeys(modelDiff, newTable);
compareUniqueKeys(modelDiff, newTable);
compareTableAttrs(modelDiff, newTable);
-
+
}
private void compareColumns(ModelDiff modelDiff, MTable newTable) {
@@ -366,7 +341,7 @@ public class MTable {
modelDiff.addUniqueConstraint(newKey.addUniqueConstraint(name));
}
}
-
+
private void compareTableAttrs(ModelDiff modelDiff, MTable newTable) {
AlterTable alterTable = new AlterTable();
alterTable.setName(newTable.getName());
@@ -478,11 +453,11 @@ public class MTable {
public void setComment(String comment) {
this.comment = comment;
}
-
+
public void setTablespaceMeta(TablespaceMeta tablespaceMeta) {
this.tablespaceMeta = tablespaceMeta;
}
-
+
public TablespaceMeta getTablespaceMeta() {
return tablespaceMeta;
}
diff --git a/ebean-externalmapping-api/pom.xml b/ebean-externalmapping-api/pom.xml
index a57da8454..27b46c7d6 100644
--- a/ebean-externalmapping-api/pom.xml
+++ b/ebean-externalmapping-api/pom.xml
@@ -4,7 +4,7 @@
ebean-parent
io.ebean
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
ebean external mapping api
diff --git a/ebean-externalmapping-xml/pom.xml b/ebean-externalmapping-xml/pom.xml
index 5e03c7551..04d257612 100644
--- a/ebean-externalmapping-xml/pom.xml
+++ b/ebean-externalmapping-xml/pom.xml
@@ -4,7 +4,7 @@
ebean-parent
io.ebean
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
@@ -28,7 +28,7 @@
io.ebean
ebean-externalmapping-api
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
@@ -61,21 +61,21 @@
io.ebean
ebean-platform-h2
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
test
io.ebean
ebean-core
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
test
io.ebean
ebean-ddl-generator
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
test
diff --git a/ebean-kotlin/pom.xml b/ebean-kotlin/pom.xml
index 4f5b062ab..d713ca7f5 100644
--- a/ebean-kotlin/pom.xml
+++ b/ebean-kotlin/pom.xml
@@ -4,7 +4,7 @@
ebean-parent
io.ebean
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
ebean-kotlin
@@ -26,7 +26,7 @@
io.ebean
ebean-core
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
provided
@@ -48,7 +48,7 @@
io.ebean
ebean-test
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
test
diff --git a/ebean-postgis/pom.xml b/ebean-postgis/pom.xml
index 8afe8e000..fdd617eb9 100644
--- a/ebean-postgis/pom.xml
+++ b/ebean-postgis/pom.xml
@@ -4,7 +4,7 @@
ebean-parent
io.ebean
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
ebean postgis
@@ -22,14 +22,14 @@
io.ebean
ebean-platform-postgres
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
io.ebean
ebean-core
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
provided
@@ -73,7 +73,7 @@
io.ebean
ebean-test
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
test
diff --git a/ebean-postgis/src/main/java/io/ebean/postgis/ScalarTypePgisBase.java b/ebean-postgis/src/main/java/io/ebean/postgis/ScalarTypePgisBase.java
index 27bf5200b..adc3bbd98 100644
--- a/ebean-postgis/src/main/java/io/ebean/postgis/ScalarTypePgisBase.java
+++ b/ebean-postgis/src/main/java/io/ebean/postgis/ScalarTypePgisBase.java
@@ -108,7 +108,7 @@ abstract class ScalarTypePgisBase implements ScalarType {
@Override
public void loadIgnore(DataReader reader) {
-
+ reader.incrementPos(1);
}
@Override
diff --git a/ebean-postgis/src/main/java/io/ebean/postgis/latte/ScalarTypeGeoLatteBase.java b/ebean-postgis/src/main/java/io/ebean/postgis/latte/ScalarTypeGeoLatteBase.java
index f4c5d7769..2dd779c38 100644
--- a/ebean-postgis/src/main/java/io/ebean/postgis/latte/ScalarTypeGeoLatteBase.java
+++ b/ebean-postgis/src/main/java/io/ebean/postgis/latte/ScalarTypeGeoLatteBase.java
@@ -99,7 +99,7 @@ abstract class ScalarTypeGeoLatteBase implements ScalarType<
@Override
public void loadIgnore(DataReader reader) {
-
+ reader.incrementPos(1);
}
@Override
diff --git a/ebean-querybean/pom.xml b/ebean-querybean/pom.xml
index 87d40c50d..6971fa507 100644
--- a/ebean-querybean/pom.xml
+++ b/ebean-querybean/pom.xml
@@ -4,7 +4,7 @@
ebean-parent
io.ebean
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
ebean querybean
@@ -17,7 +17,7 @@
io.ebean
ebean-core
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
provided
@@ -63,21 +63,21 @@
io.ebean
ebean-ddl-generator
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
test
io.ebean
querybean-generator
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
test
io.ebean
ebean-test
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
test
diff --git a/ebean-redis/pom.xml b/ebean-redis/pom.xml
index 85da71def..0e44b3e15 100644
--- a/ebean-redis/pom.xml
+++ b/ebean-redis/pom.xml
@@ -4,7 +4,7 @@
ebean-parent
io.ebean
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
ebean-redis
@@ -16,41 +16,41 @@
redis.clients
jedis
- 4.2.1
+ 4.2.2
io.ebean
ebean-api
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
provided
io.ebean
ebean-core
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
provided
io.ebean
ebean-querybean
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
test
io.ebean
querybean-generator
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
test
io.ebean
ebean-test
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
test
diff --git a/ebean-test/pom.xml b/ebean-test/pom.xml
index b40489f5a..501c10f31 100644
--- a/ebean-test/pom.xml
+++ b/ebean-test/pom.xml
@@ -4,7 +4,7 @@
ebean-parent
io.ebean
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
ebean test
@@ -29,20 +29,20 @@
io.ebean
ebean-platform-h2
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
io.ebean
ebean-core
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
provided
io.ebean
ebean-ddl-generator
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
@@ -106,14 +106,14 @@
io.ebean
ebean-platform-all
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
test
io.ebean
ebean-dbmigration-runner
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
test
@@ -176,14 +176,14 @@
com.microsoft.sqlserver
mssql-jdbc
- 9.4.0.jre8
+ 10.2.0.jre8
test
mysql
mysql-connector-java
- 8.0.26
+ 8.0.28
test
@@ -197,7 +197,7 @@
com.sap.cloud.db.jdbc
ngdbc
- 2.3.48
+ 2.12.9
test
@@ -235,14 +235,14 @@
ru.yandex.clickhouse
clickhouse-jdbc
- 0.3.1-patch
+ 0.3.2
test
ch.qos.logback
logback-classic
- 1.2.10
+ 1.2.11
test
diff --git a/ebean-test/src/test/java/io/ebean/xtest/base/FetchConfigTest.java b/ebean-test/src/test/java/io/ebean/xtest/base/FetchConfigTest.java
index 122c1b122..bef706e97 100644
--- a/ebean-test/src/test/java/io/ebean/xtest/base/FetchConfigTest.java
+++ b/ebean-test/src/test/java/io/ebean/xtest/base/FetchConfigTest.java
@@ -9,31 +9,31 @@ public class FetchConfigTest {
@Test
public void testLazy() {
- FetchConfig config = new FetchConfig().lazy();
+ FetchConfig config = FetchConfig.ofLazy();
assertThat(config.getBatchSize()).isEqualTo(0);
}
@Test
public void testLazy_withParameter() {
- FetchConfig config = new FetchConfig().lazy(50);
+ FetchConfig config = FetchConfig.ofLazy(50);
assertThat(config.getBatchSize()).isEqualTo(50);
}
@Test
public void testQuery() {
- FetchConfig config = new FetchConfig().query();
+ FetchConfig config = FetchConfig.ofQuery();
assertThat(config.getBatchSize()).isEqualTo(100);
}
@Test
public void testQuery_withParameter() {
- FetchConfig config = new FetchConfig().query(50);
+ FetchConfig config = FetchConfig.ofQuery(50);
assertThat(config.getBatchSize()).isEqualTo(50);
}
@Test
public void testQueryFirst() {
- FetchConfig config = new FetchConfig().queryFirst(50);
+ FetchConfig config = FetchConfig.ofQuery(50);
assertThat(config.getBatchSize()).isEqualTo(50);
}
@@ -52,67 +52,67 @@ public class FetchConfigTest {
@Test
public void testEquals_when_noOptions() {
- assertSame(new FetchConfig(), new FetchConfig());
+ assertSame(FetchConfig.ofDefault(), FetchConfig.ofDefault());
}
@Test
public void testEquals_when_query_50_lazy_40() {
- assertSame(new FetchConfig().query(50), FetchConfig.ofQuery(50));
+ assertSame(FetchConfig.ofQuery(50), FetchConfig.ofQuery(50));
}
@Test
public void testEquals_when_query_50_lazy() {
- assertSame(new FetchConfig().lazy(), FetchConfig.ofLazy());
+ assertSame(FetchConfig.ofLazy(), FetchConfig.ofLazy());
}
@Test
public void testEquals_when_query_50() {
- assertSame(new FetchConfig().query(50), new FetchConfig().query(50));
+ assertSame(FetchConfig.ofQuery(50), FetchConfig.ofQuery(50));
}
@Test
public void testEquals_when_queryFirst_50_lazy_40() {
- assertSame(new FetchConfig().queryFirst(50).lazy(40), FetchConfig.ofLazy(40));
+ assertSame(FetchConfig.ofLazy(40), FetchConfig.ofLazy(40));
}
@Test
public void testEquals_when_queryFirst_50_lazy() {
- assertSame(new FetchConfig().queryFirst(50).lazy(), new FetchConfig().queryFirst(50).lazy());
+ assertSame(FetchConfig.ofLazy(), FetchConfig.ofLazy());
}
@Test
public void testEquals_when_queryFirst_50() {
- assertSame(new FetchConfig().queryFirst(50), FetchConfig.ofQuery(50));
+ assertSame(FetchConfig.ofQuery(50), FetchConfig.ofQuery(50));
}
@Test
public void testNotEquals_when_query_50() {
- assertDifferent(new FetchConfig().query(50), new FetchConfig().query(40));
+ assertDifferent(FetchConfig.ofQuery(50), FetchConfig.ofQuery(40));
}
@Test
public void testNotEquals_when_query_50_lazy() {
- assertDifferent(new FetchConfig().query(50), new FetchConfig().query(50).lazy());
+ assertDifferent(FetchConfig.ofQuery(50), FetchConfig.ofLazy(50));
}
@Test
public void testNotEquals_when_query_50_lazy_40() {
- assertDifferent(new FetchConfig().query(50), new FetchConfig().query(50).lazy(40));
+ assertDifferent(FetchConfig.ofQuery(50), FetchConfig.ofLazy(40));
}
@Test
public void testNotEquals_when_queryFirst_50() {
- assertDifferent(new FetchConfig().queryFirst(50), new FetchConfig().queryFirst(40));
+ assertDifferent(FetchConfig.ofQuery(50), FetchConfig.ofQuery(40));
}
@Test
public void testNotEquals_when_queryFirst_50_lazy() {
- assertDifferent(new FetchConfig().queryFirst(50), new FetchConfig().queryFirst(50).lazy());
+ assertDifferent(FetchConfig.ofQuery(50), FetchConfig.ofLazy());
}
@Test
public void testNotEquals_when_queryFirst_50_lazy_40() {
- assertDifferent(new FetchConfig().queryFirst(50), new FetchConfig().queryFirst(50).lazy(40));
+ assertDifferent(FetchConfig.ofQuery(50), FetchConfig.ofLazy(40));
}
void assertDifferent(FetchConfig v1, FetchConfig v2) {
diff --git a/ebean-test/src/test/java/org/tests/model/history/HistoryOneToOne.java b/ebean-test/src/test/java/org/tests/model/history/HistoryOneToOne.java
new file mode 100644
index 000000000..aabe3d197
--- /dev/null
+++ b/ebean-test/src/test/java/org/tests/model/history/HistoryOneToOne.java
@@ -0,0 +1,29 @@
+package org.tests.model.history;
+
+import io.ebean.annotation.History;
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.OneToOne;
+import org.tests.model.draftable.BaseDomain;
+
+@History
+@Entity
+public class HistoryOneToOne extends BaseDomain {
+
+ final String name;
+
+ @OneToOne(cascade = CascadeType.REFRESH)
+ HistorylessOneToOne historylessOneToOne;
+
+ public HistoryOneToOne(String name) {
+ this.name = name;
+ }
+
+ public HistorylessOneToOne less() {
+ return historylessOneToOne;
+ }
+
+ public String getName() {
+ return name;
+ }
+}
diff --git a/ebean-test/src/test/java/org/tests/model/history/HistorylessOneToOne.java b/ebean-test/src/test/java/org/tests/model/history/HistorylessOneToOne.java
new file mode 100644
index 000000000..f9053cb32
--- /dev/null
+++ b/ebean-test/src/test/java/org/tests/model/history/HistorylessOneToOne.java
@@ -0,0 +1,35 @@
+package org.tests.model.history;
+
+import org.tests.model.draftable.BaseDomain;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.OneToOne;
+
+@Entity
+public class HistorylessOneToOne extends BaseDomain {
+
+ private final String name;
+
+ /**
+ * This @OneToOne(mappedBy=...) side should really be FetchType.LAZY
+ */
+ @OneToOne(mappedBy = "historylessOneToOne", cascade = CascadeType.ALL, orphanRemoval = true)//, fetch = FetchType.LAZY)
+ HistoryOneToOne historyOneToOne;
+
+ public HistorylessOneToOne(final String name) {
+ this.name = name;
+ }
+
+ public HistoryOneToOne getHistoryOneToOne() {
+ return historyOneToOne;
+ }
+
+ public void setHistoryOneToOne(final HistoryOneToOne historyOneToOne) {
+ this.historyOneToOne = historyOneToOne;
+ }
+
+ public String getName() {
+ return name;
+ }
+}
diff --git a/ebean-test/src/test/java/org/tests/model/history/TestHistoryOneToOne.java b/ebean-test/src/test/java/org/tests/model/history/TestHistoryOneToOne.java
new file mode 100644
index 000000000..cf629f9ac
--- /dev/null
+++ b/ebean-test/src/test/java/org/tests/model/history/TestHistoryOneToOne.java
@@ -0,0 +1,90 @@
+package org.tests.model.history;
+
+import io.ebean.DB;
+import io.ebean.annotation.Platform;
+import io.ebean.xtest.BaseTestCase;
+import io.ebean.xtest.IgnorePlatform;
+import org.junit.jupiter.api.Test;
+
+import java.sql.Timestamp;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+class TestHistoryOneToOne extends BaseTestCase {
+
+ private Long expectedLessId;
+ private Long expectedHistoryId;
+
+ @IgnorePlatform({Platform.ORACLE, Platform.COCKROACH})
+ @Test
+ void test() throws InterruptedException {
+ HistorylessOneToOne historylessOneToOne = new HistorylessOneToOne("less");
+ historylessOneToOne.setHistoryOneToOne(new HistoryOneToOne("one"));
+ DB.save(historylessOneToOne);
+ Thread.sleep(20);
+
+ expectedLessId = historylessOneToOne.getId();
+ expectedHistoryId = historylessOneToOne.getHistoryOneToOne().getId();
+
+ findViaHistory();
+ findViaLess();
+
+ findViaLess_fetch();
+ findViaHistory_fetch();
+ }
+
+ private void findViaLess() {
+ HistorylessOneToOne lessFetched = DB.find(HistorylessOneToOne.class)
+ .asOf(new Timestamp(System.currentTimeMillis()))
+ .findOne();
+
+ expected_findViaLess(lessFetched);
+ }
+
+
+ private void findViaLess_fetch() {
+ HistorylessOneToOne lessFetched = DB.find(HistorylessOneToOne.class)
+ .asOf(new Timestamp(System.currentTimeMillis()))
+ .fetch("historyOneToOne")
+ .findOne();
+
+ expected_findViaLess(lessFetched);
+ }
+
+ private void expected_findViaLess(HistorylessOneToOne lessFetched) {
+ assert lessFetched != null;
+ assertThat(lessFetched.getId()).isEqualTo(expectedLessId);
+ HistoryOneToOne history1 = lessFetched.getHistoryOneToOne();
+ assertThat(history1.getId()).isEqualTo(expectedHistoryId);
+ assertThat(history1.less().getId()).isEqualTo(expectedLessId);
+ assertThat(history1.less().getName()).isEqualTo("less");
+ assertThat(history1.getName()).isEqualTo("one");
+ }
+
+
+ private void findViaHistory_fetch() {
+
+ HistoryOneToOne oneFetched = DB.find(HistoryOneToOne.class)
+ .asOf(new Timestamp(System.currentTimeMillis()))
+ .fetch("historylessOneToOne")
+ .findOne();
+
+ expected_viaHistory(oneFetched);
+ }
+
+ private void findViaHistory() {
+ HistoryOneToOne oneFetched = DB.find(HistoryOneToOne.class)
+ .asOf(new Timestamp(System.currentTimeMillis()))
+ .findOne();
+
+ expected_viaHistory(oneFetched);
+ }
+
+ private void expected_viaHistory(HistoryOneToOne oneFetched) {
+ assert oneFetched != null;
+ assertThat(oneFetched.getId()).isEqualTo(expectedHistoryId);
+ assertThat(oneFetched.less().getId()).isEqualTo(expectedLessId);
+ assertThat(oneFetched.less().getName()).isEqualTo("less");
+ assertThat(oneFetched.getName()).isEqualTo("one");
+ }
+}
diff --git a/ebean-test/src/test/java/org/tests/query/joins/TestQueryJoinOnFormula.java b/ebean-test/src/test/java/org/tests/query/joins/TestQueryJoinOnFormula.java
index 81eb2cfc1..66c2a7616 100644
--- a/ebean-test/src/test/java/org/tests/query/joins/TestQueryJoinOnFormula.java
+++ b/ebean-test/src/test/java/org/tests/query/joins/TestQueryJoinOnFormula.java
@@ -68,7 +68,7 @@ public class TestQueryJoinOnFormula extends BaseTestCase {
List sql = LoggedSql.stop();
assertEquals(1, sql.size());
assertSql(sql.get(0)).contains("join (select order_id, count(*) as total_items,");
- assertSql(sql.get(0)).contains("select count(*) from ( select t0.id from o_order t0 left join (select order_id,");
+ assertSql(sql.get(0)).contains("select count(*) from ( select t0.id from o_order t0 left join (select order_id,");
}
@Test
@@ -83,7 +83,7 @@ public class TestQueryJoinOnFormula extends BaseTestCase {
shipQuery.findList();
assertSql(shipQuery.getGeneratedSql()).isEqualTo("select t0.id "
+ "from or_order_ship t0 "
- + "left join o_order t1 on t1.id = t0.order_id "
+ + "left join o_order t1 on t1.id = t0.order_id "
+ "left join (select order_id, count(*) as total_items, sum(order_qty*unit_price) as total_amount from o_order_detail group by order_id) z_bt1 on z_bt1.order_id = t1.id "
+ "order by z_bt1.total_amount");
}
@@ -100,7 +100,7 @@ public class TestQueryJoinOnFormula extends BaseTestCase {
shipQuery.findList();
assertSql(shipQuery.getGeneratedSql()).isEqualTo("select t0.id "
+ "from or_order_ship t0 "
- + "left join o_order t1 on t1.id = t0.order_id "
+ + "left join o_order t1 on t1.id = t0.order_id "
+ "left join (select order_id, count(*) as total_items, sum(order_qty*unit_price) as total_amount from o_order_detail group by order_id) z_bt1 on z_bt1.order_id = t1.id "
+ "where z_bt1.total_amount is not null");
}
@@ -124,7 +124,7 @@ public class TestQueryJoinOnFormula extends BaseTestCase {
"from or_order_ship t0 " +
"join o_order u1 on u1.id = t0.order_id " +
"join or_order_ship u2 on u2.order_id = u1.id " +
- "join o_order u3 on u3.id = u2.order_id " +
+ "join o_order u3 on u3.id = u2.order_id " +
"left join (select order_id, count(*) as total_items, sum(order_qty*unit_price) as total_amount from o_order_detail group by order_id) z_bu3 on z_bu3.order_id = u3.id " +
"where z_bu3.total_amount is not null");
}
@@ -141,7 +141,7 @@ public class TestQueryJoinOnFormula extends BaseTestCase {
shipQuery.findList();
assertSql(shipQuery.getGeneratedSql()).isEqualTo("select t0.id, t1.id, z_bt1.total_amount "
+ "from or_order_ship t0 "
- + "left join o_order t1 on t1.id = t0.order_id "
+ + "left join o_order t1 on t1.id = t0.order_id "
+ "left join (select order_id, count(*) as total_items, sum(order_qty*unit_price) as total_amount from o_order_detail group by order_id) z_bt1 on z_bt1.order_id = t1.id "
+ "order by z_bt1.total_amount");
@@ -158,7 +158,7 @@ public class TestQueryJoinOnFormula extends BaseTestCase {
shipQuery.findList();
assertSql(shipQuery.getGeneratedSql()).isEqualTo("select t0.id, t1.id, z_bt1.total_amount "
+ "from or_order_ship t0 "
- + "left join o_order t1 on t1.id = t0.order_id "
+ + "left join o_order t1 on t1.id = t0.order_id "
+ "left join (select order_id, count(*) as total_items, sum(order_qty*unit_price) as total_amount from o_order_detail group by order_id) z_bt1 on z_bt1.order_id = t1.id "
+ "where z_bt1.total_amount is not null");
@@ -179,7 +179,7 @@ public class TestQueryJoinOnFormula extends BaseTestCase {
List sql = LoggedSql.stop();
assertEquals(1, sql.size());
- assertSql(sql.get(0)).contains("select count(*) from ( select t0.id from o_order t0 left join (select order_id,");
+ assertSql(sql.get(0)).contains("select count(*) from ( select t0.id from o_order t0 left join (select order_id,");
}
@Test
diff --git a/ebean-test/src/test/resources/ebean.properties b/ebean-test/src/test/resources/ebean.properties
index 6d1aea171..0a64c9808 100644
--- a/ebean-test/src/test/resources/ebean.properties
+++ b/ebean-test/src/test/resources/ebean.properties
@@ -23,7 +23,7 @@ ebean.ddl.run=true
ebean.ddl.header=-- Generated by ebean ${version} at ${timestamp}
ebean.packages=org.tests,org.etest
datasource.default=h2
-#datasource.default=yugabyte
+#datasource.default=sqlserver
#datasource.h2.capturestacktrace=true
#ebean.dumpMetricsOnShutdown=true
@@ -177,7 +177,8 @@ ebean.sqlserver.databasePlatformName=sqlserver17
#ebean.sqlserver.caseSensitiveCollation=false
datasource.sqlserver.username=test_ebean
datasource.sqlserver.password=SqlS3rv#r
-datasource.sqlserver.url=jdbc:sqlserver://localhost:1433;databaseName=test_ebean;sendTimeAsDateTime=false
+#datasource.sqlserver.url=jdbc:sqlserver://localhost:1433;databaseName=test_ebean;sendTimeAsDateTime=false;integratedSecurity=false;trustServerCertificate=true
+datasource.sqlserver.url=jdbc:sqlserver://localhost:9435;databaseName=test_ebean;sendTimeAsDateTime=false;integratedSecurity=false;trustServerCertificate=true
#datasource.sqlserver.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
datasource.nuodb.schema=test_user
diff --git a/ebean-test/testconfig/ebean-sqlserver17.properties b/ebean-test/testconfig/ebean-sqlserver17.properties
index c0388b6ec..103b1fea2 100644
--- a/ebean-test/testconfig/ebean-sqlserver17.properties
+++ b/ebean-test/testconfig/ebean-sqlserver17.properties
@@ -4,7 +4,7 @@ ebean.test.sqlserver.version=2017-CU28-ubuntu-16.04
ebean.test.sqlserver.containerName=local_sqlserver2017
ebean.test.sqlserver.collation=LATIN1_GENERAL_100_CS_AS_SC
ebean.test.sqlserver.port=9435
-ebean.test.sqlserver.url=jdbc:sqlserver://localhost:9435;databaseName=test_ebean;sendTimeAsDateTime=false
+ebean.test.sqlserver.url=jdbc:sqlserver://localhost:9435;databaseName=test_ebean;sendTimeAsDateTime=false;integratedSecurity=false;trustServerCertificate=true
datasource.default=sqlserver2017
ebean.sqlserver2017.databasePlatformName=sqlserver17
diff --git a/ebean-test/testconfig/ebean-sqlserver19.properties b/ebean-test/testconfig/ebean-sqlserver19.properties
index 5c8accf32..80ffe7320 100644
--- a/ebean-test/testconfig/ebean-sqlserver19.properties
+++ b/ebean-test/testconfig/ebean-sqlserver19.properties
@@ -4,7 +4,7 @@ ebean.test.sqlserver.version=2019-latest
ebean.test.sqlserver.containerName=local_sqlserver2019
ebean.test.sqlserver.collation=LATIN1_GENERAL_100_CS_AS_SC_UTF8
ebean.test.sqlserver.port=9434
-ebean.test.sqlserver.url=jdbc:sqlserver://localhost:9434;databaseName=test_ebean;sendTimeAsDateTime=false
+ebean.test.sqlserver.url=jdbc:sqlserver://localhost:9434;databaseName=test_ebean;sendTimeAsDateTime=false;integratedSecurity=false;trustServerCertificate=true
datasource.default=sqlserver2019
ebean.sqlserver2019.databasePlatformName=sqlserver17
diff --git a/kotlin-querybean-generator/pom.xml b/kotlin-querybean-generator/pom.xml
index 83d0d9775..7dc042333 100644
--- a/kotlin-querybean-generator/pom.xml
+++ b/kotlin-querybean-generator/pom.xml
@@ -4,7 +4,7 @@
ebean-parent
io.ebean
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
kotlin querybean generator
@@ -29,7 +29,7 @@
io.ebean
ebean-querybean
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
test
@@ -43,7 +43,7 @@
io.ebean
ebean-core
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
test
@@ -64,7 +64,7 @@
io.ebean
ebean-ddl-generator
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
test
diff --git a/platforms/all/pom.xml b/platforms/all/pom.xml
index d5731088f..291dabf84 100644
--- a/platforms/all/pom.xml
+++ b/platforms/all/pom.xml
@@ -4,7 +4,7 @@
platforms
io.ebean
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
ebean-platform-all
@@ -14,67 +14,67 @@
io.ebean
ebean-platform-h2
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
io.ebean
ebean-platform-clickhouse
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
io.ebean
ebean-platform-db2
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
io.ebean
ebean-platform-hana
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
io.ebean
ebean-platform-hsqldb
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
io.ebean
ebean-platform-mysql
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
io.ebean
ebean-platform-mariadb
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
io.ebean
ebean-platform-nuodb
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
io.ebean
ebean-platform-oracle
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
io.ebean
ebean-platform-postgres
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
io.ebean
ebean-platform-sqlanywhere
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
io.ebean
ebean-platform-sqlite
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
io.ebean
ebean-platform-sqlserver
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
diff --git a/platforms/clickhouse/pom.xml b/platforms/clickhouse/pom.xml
index 589e00d14..fd4554cc3 100644
--- a/platforms/clickhouse/pom.xml
+++ b/platforms/clickhouse/pom.xml
@@ -4,7 +4,7 @@
platforms
io.ebean
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
ebean-platform-clickhouse
@@ -14,7 +14,7 @@
io.ebean
ebean-api
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
diff --git a/platforms/db2/pom.xml b/platforms/db2/pom.xml
index b37396161..13ca5340c 100644
--- a/platforms/db2/pom.xml
+++ b/platforms/db2/pom.xml
@@ -4,7 +4,7 @@
platforms
io.ebean
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
ebean-platform-db2
@@ -14,7 +14,7 @@
io.ebean
ebean-api
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
diff --git a/platforms/h2/pom.xml b/platforms/h2/pom.xml
index f9afa8928..8190fa566 100644
--- a/platforms/h2/pom.xml
+++ b/platforms/h2/pom.xml
@@ -4,7 +4,7 @@
platforms
io.ebean
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT
ebean-platform-h2
@@ -14,7 +14,7 @@
io.ebean
ebean-api
- 13.3.1-FOC3-SNAPSHOT
+ 13.5.1-FOC2-SNAPSHOT