mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Compare commits
67
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aa27aedca9 | ||
|
|
172c1d10a1 | ||
|
|
da6f7d671b | ||
|
|
6e10d641b2 | ||
|
|
c5dca69482 | ||
|
|
371a50176e | ||
|
|
56fed3ad87 | ||
|
|
9a65731be9 | ||
|
|
34b011f683 | ||
|
|
69c721b66e | ||
|
|
f2a578cd76 | ||
|
|
1e34d65675 | ||
|
|
60db0b0999 | ||
|
|
3bfb6dbc20 | ||
|
|
d4d9bb204d | ||
|
|
bedb841fa9 | ||
|
|
c4c4663144 | ||
|
|
b392db866c | ||
|
|
3556f9a42b | ||
|
|
0345ca9f18 | ||
|
|
eacc4b907d | ||
|
|
09cb5da3d3 | ||
|
|
b22791c15b | ||
|
|
df3eda411a | ||
|
|
5b10c053de | ||
|
|
bf2d75e55e | ||
|
|
6f7efe6922 | ||
|
|
90e321ddbd | ||
|
|
9649d71082 | ||
|
|
932337d83d | ||
|
|
7e4bde8d34 | ||
|
|
01e8b5f471 | ||
|
|
68a6da22be | ||
|
|
986f3b5bca | ||
|
|
4b1bb9d1ee | ||
|
|
ec340c0abe | ||
|
|
b062ec050c | ||
|
|
965f4c6227 | ||
|
|
bdc4022211 | ||
|
|
7edfe3607d | ||
|
|
e1731b87ec | ||
|
|
ebadc92f63 | ||
|
|
ea56ec7435 | ||
|
|
3b990fb6e1 | ||
|
|
96b4fbea4b | ||
|
|
9161e17476 | ||
|
|
190a2c47e9 | ||
|
|
d096706685 | ||
|
|
7521cb530e | ||
|
|
dde9b507ce | ||
|
|
183416a640 | ||
|
|
826e8518ea | ||
|
|
55587b12aa | ||
|
|
285a94e5fe | ||
|
|
16a05528b7 | ||
|
|
b4f4ef3c1b | ||
|
|
cd407ee467 | ||
|
|
9ee63144e5 | ||
|
|
0413d89a9e | ||
|
|
f33e54d8ba | ||
|
|
a2b19d46e1 | ||
|
|
4163b4dc25 | ||
|
|
12220d4322 | ||
|
|
14262d4c25 | ||
|
|
f3ec4a78c9 | ||
|
|
f7a0ae8b4a | ||
|
|
4cebb367de |
+1
-1
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.11.1</version>
|
||||
<version>12.11.2</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean api</name>
|
||||
|
||||
@@ -118,4 +118,9 @@ public interface BeanState {
|
||||
*/
|
||||
@Nullable
|
||||
Map<String, Exception> getLoadErrors();
|
||||
|
||||
/**
|
||||
* Return the sort order value for an order column.
|
||||
*/
|
||||
int getSortOrder();
|
||||
}
|
||||
|
||||
@@ -1232,7 +1232,8 @@ public final class EntityBeanIntercept implements Serializable {
|
||||
if (mutableNext == null) {
|
||||
return null;
|
||||
}
|
||||
return mutableNext[propertyIndex].content();
|
||||
final MutableValueNext next = mutableNext[propertyIndex];
|
||||
return next != null ? next.content() : null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.11.1</version>
|
||||
<version>12.11.2</version>
|
||||
</parent>
|
||||
<!-- <parent>-->
|
||||
<!-- <groupId>org.avaje</groupId>-->
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
<scm>
|
||||
<developerConnection>scm:git:git@github.com:ebean-orm/ebean.git</developerConnection>
|
||||
<tag>ebean-parent-12.11.1</tag>
|
||||
<tag>ebean-parent-12.11.2</tag>
|
||||
</scm>
|
||||
|
||||
<name>ebean autotune</name>
|
||||
@@ -26,7 +26,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>12.11.1</version>
|
||||
<version>12.11.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
+15
-25
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.11.1</version>
|
||||
<version>12.11.2</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean bom</name>
|
||||
@@ -12,16 +12,6 @@
|
||||
<artifactId>ebean-bom</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<properties>
|
||||
<ebean-ddl-runner.version>1.0</ebean-ddl-runner.version>
|
||||
<ebean-migration-auto.version>1.1</ebean-migration-auto.version>
|
||||
<ebean-migration.version>12.11.0</ebean-migration.version>
|
||||
<ebean-test-docker.version>4.1</ebean-test-docker.version>
|
||||
<ebean-datasource.version>7.0</ebean-datasource.version>
|
||||
<ebean-agent.version>12.11.0</ebean-agent.version>
|
||||
<ebean-maven-plugin.version>12.11.0</ebean-maven-plugin.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
@@ -81,88 +71,88 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean</artifactId>
|
||||
<version>12.11.1</version>
|
||||
<version>12.11.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>12.11.1</version>
|
||||
<version>12.11.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>12.11.1</version>
|
||||
<version>12.11.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>12.11.1</version>
|
||||
<version>12.11.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-generator</artifactId>
|
||||
<version>12.11.1</version>
|
||||
<version>12.11.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-externalmapping-api</artifactId>
|
||||
<version>12.11.1</version>
|
||||
<version>12.11.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-externalmapping-xml</artifactId>
|
||||
<version>12.11.1</version>
|
||||
<version>12.11.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-autotune</artifactId>
|
||||
<version>12.11.1</version>
|
||||
<version>12.11.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>12.11.1</version>
|
||||
<version>12.11.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>querybean-generator</artifactId>
|
||||
<version>12.11.1</version>
|
||||
<version>12.11.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>kotlin-querybean-generator</artifactId>
|
||||
<version>12.11.1</version>
|
||||
<version>12.11.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
<version>12.11.1</version>
|
||||
<version>12.11.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-postgis</artifactId>
|
||||
<version>12.11.1</version>
|
||||
<version>12.11.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-redis</artifactId>
|
||||
<version>12.11.1</version>
|
||||
<version>12.11.2</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.11.1</version>
|
||||
<version>12.11.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
@@ -16,7 +16,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>12.11.1</version>
|
||||
<version>12.11.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
+6
-6
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.11.1</version>
|
||||
<version>12.11.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ebean-core</artifactId>
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
<scm>
|
||||
<developerConnection>scm:git:git@github.com:ebean-orm/ebean.git</developerConnection>
|
||||
<tag>ebean-parent-12.11.1</tag>
|
||||
<tag>ebean-parent-12.11.2</tag>
|
||||
</scm>
|
||||
|
||||
<profiles>
|
||||
@@ -78,19 +78,19 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>12.11.1</version>
|
||||
<version>12.11.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>12.11.1</version>
|
||||
<version>12.11.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-externalmapping-api</artifactId>
|
||||
<version>12.11.1</version>
|
||||
<version>12.11.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -293,7 +293,7 @@
|
||||
<plugin>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-maven-plugin</artifactId>
|
||||
<version>12.10.0</version>
|
||||
<version>${ebean-maven-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>test</id>
|
||||
|
||||
@@ -6,7 +6,7 @@ import java.util.List;
|
||||
/**
|
||||
* The results of bean cache hit.
|
||||
*/
|
||||
public class BeanCacheResult<T> {
|
||||
public final class BeanCacheResult<T> {
|
||||
|
||||
private final List<Entry<T>> list = new ArrayList<>();
|
||||
|
||||
@@ -27,7 +27,7 @@ public class BeanCacheResult<T> {
|
||||
/**
|
||||
* Bean and cache key pair.
|
||||
*/
|
||||
static class Entry<T> {
|
||||
static final class Entry<T> {
|
||||
|
||||
private final T bean;
|
||||
private final Object key;
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.io.IOException;
|
||||
/**
|
||||
* Context used to read binary format messages.
|
||||
*/
|
||||
public class BinaryReadContext {
|
||||
public final class BinaryReadContext {
|
||||
|
||||
private final DataInputStream in;
|
||||
|
||||
|
||||
@@ -6,10 +6,9 @@ import java.io.IOException;
|
||||
/**
|
||||
* Context used to write binary message (like RemoteTransactionEvent).
|
||||
*/
|
||||
public class BinaryWriteContext {
|
||||
public final class BinaryWriteContext {
|
||||
|
||||
private final DataOutputStream out;
|
||||
|
||||
private long counter;
|
||||
|
||||
public BinaryWriteContext(DataOutputStream out) {
|
||||
|
||||
@@ -13,35 +13,28 @@ import java.util.Map.Entry;
|
||||
* Supports ordered or named parameters.
|
||||
* </p>
|
||||
*/
|
||||
public class BindParams implements Serializable {
|
||||
public final class BindParams implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 4541081933302086285L;
|
||||
|
||||
private final List<Param> positionedParameters = new ArrayList<>();
|
||||
|
||||
private final Map<String, Param> namedParameters = new LinkedHashMap<>();
|
||||
|
||||
/**
|
||||
* This is the sql. For named parameters this is the sql after the named
|
||||
* parameters have been replaced with question mark place holders and the
|
||||
* parameters have been ordered by addNamedParamInOrder().
|
||||
*/
|
||||
private String preparedSql;
|
||||
|
||||
/**
|
||||
* Bind hash and count used to detect when the bind values have changed such
|
||||
* that the generated SQL (with named parameters) needs to be recalculated.
|
||||
*/
|
||||
private String bindHash;
|
||||
|
||||
/**
|
||||
* Helper to add positioned parameters in order.
|
||||
*/
|
||||
private int addPos;
|
||||
|
||||
public BindParams() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset positioned parameters (usually due to bind parameter expansion).
|
||||
*/
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.util.List;
|
||||
* The equals/hashCode implementation must meet the requirement that the query bind values
|
||||
* match for L2 query cache hit (given the query plan hash is already a match).
|
||||
*/
|
||||
public class BindValuesKey {
|
||||
public final class BindValuesKey {
|
||||
|
||||
private final List<Object> values = new ArrayList<>();
|
||||
|
||||
|
||||
@@ -11,10 +11,9 @@ import java.util.Set;
|
||||
/**
|
||||
* Used for bean cache lookup with where ids in expression.
|
||||
*/
|
||||
public class CacheIdLookupMany<T> implements CacheIdLookup<T> {
|
||||
public final class CacheIdLookupMany<T> implements CacheIdLookup<T> {
|
||||
|
||||
private final IdInExpression idInExpression;
|
||||
|
||||
private int remaining;
|
||||
|
||||
public CacheIdLookupMany(IdInExpression idInExpression) {
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.util.List;
|
||||
/**
|
||||
* Used for bean cache lookup with a single id value.
|
||||
*/
|
||||
public class CacheIdLookupSingle<T> implements CacheIdLookup<T> {
|
||||
public final class CacheIdLookupSingle<T> implements CacheIdLookup<T> {
|
||||
|
||||
private final Object idValue;
|
||||
private boolean found;
|
||||
|
||||
@@ -6,7 +6,7 @@ import io.ebean.annotation.Platform;
|
||||
* Helper to indicate that an EbeanServer should come up offline
|
||||
* typically for DDL generation purposes.
|
||||
*/
|
||||
public class DbOffline {
|
||||
public final class DbOffline {
|
||||
|
||||
private static final String KEY = "ebean.dboffline";
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import io.ebean.metric.TimedMetric;
|
||||
/**
|
||||
* Extra metrics collected to measure internal behaviour.
|
||||
*/
|
||||
public class ExtraMetrics {
|
||||
public final class ExtraMetrics {
|
||||
|
||||
private final TimedMetric bindCapture;
|
||||
private final TimedMetric planCollect;
|
||||
|
||||
@@ -3,7 +3,7 @@ package io.ebeaninternal.api;
|
||||
/**
|
||||
* A hash key for a query including both the query plan and bind values.
|
||||
*/
|
||||
public class HashQuery {
|
||||
public final class HashQuery {
|
||||
|
||||
private final CQueryPlanKey planHash;
|
||||
private final BindValuesKey bindValuesKey;
|
||||
|
||||
@@ -6,7 +6,7 @@ import io.ebean.TxScope;
|
||||
/**
|
||||
* Helper object to make AOP generated code simpler.
|
||||
*/
|
||||
public class HelpScopeTrans {
|
||||
public final class HelpScopeTrans {
|
||||
private static boolean enabled = true;
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,16 +13,12 @@ import java.util.Set;
|
||||
/**
|
||||
* Request for loading ManyToOne and OneToOne relationships.
|
||||
*/
|
||||
public class LoadBeanRequest extends LoadRequest {
|
||||
public final class LoadBeanRequest extends LoadRequest {
|
||||
|
||||
private final List<EntityBeanIntercept> batch;
|
||||
|
||||
private final LoadBeanBuffer loadBuffer;
|
||||
|
||||
private final String lazyLoadProperty;
|
||||
|
||||
private final boolean loadCache;
|
||||
|
||||
private boolean loadedFromCache;
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,16 +15,13 @@ import java.util.List;
|
||||
/**
|
||||
* Request for loading Associated Many Beans.
|
||||
*/
|
||||
public class LoadManyRequest extends LoadRequest {
|
||||
public final class LoadManyRequest extends LoadRequest {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(LoadManyRequest.class);
|
||||
|
||||
private final List<BeanCollection<?>> batch;
|
||||
|
||||
private final LoadManyBuffer loadContext;
|
||||
|
||||
private final boolean onlyIds;
|
||||
|
||||
private final boolean loadCache;
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,16 +17,13 @@ import java.util.TreeSet;
|
||||
* Holds the joins needs to support the many where predicates.
|
||||
* These joins are independent of any 'fetch' joins on the many.
|
||||
*/
|
||||
public class ManyWhereJoins implements Serializable {
|
||||
public final class ManyWhereJoins implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -6490181101871795417L;
|
||||
|
||||
private final TreeMap<String, PropertyJoin> joins = new TreeMap<>();
|
||||
|
||||
private List<String> formulaJoinProperties;
|
||||
|
||||
private boolean aggregation;
|
||||
|
||||
/**
|
||||
* 'Mode' indicating that joins added while this is true are required to be outer joins.
|
||||
*/
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
package io.ebeaninternal.api;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Object used as a synchronization monitor that is serializable.
|
||||
*/
|
||||
public class Monitor implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -2741687226680981940L;
|
||||
|
||||
}
|
||||
@@ -11,7 +11,7 @@ import java.util.Map;
|
||||
/**
|
||||
* Natural key entry with name value pairs for each of the properties making up the key.
|
||||
*/
|
||||
class NaturalKeyEntryBasic implements NaturalKeyEntry {
|
||||
final class NaturalKeyEntryBasic implements NaturalKeyEntry {
|
||||
|
||||
private final Map<String,Object> map = new HashMap<>();
|
||||
private final String key;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.ebeaninternal.api;
|
||||
|
||||
class NaturalKeyEntrySimple implements NaturalKeyEntry {
|
||||
final class NaturalKeyEntrySimple implements NaturalKeyEntry {
|
||||
|
||||
private final String key;
|
||||
private final Object val;
|
||||
|
||||
@@ -3,7 +3,7 @@ package io.ebeaninternal.api;
|
||||
/**
|
||||
* A property value pair in a natural key lookup.
|
||||
*/
|
||||
public class NaturalKeyEq {
|
||||
public final class NaturalKeyEq {
|
||||
|
||||
final String property;
|
||||
final Object value;
|
||||
|
||||
@@ -11,28 +11,22 @@ import java.util.Set;
|
||||
/**
|
||||
* Collects the data for processing the natural key cache processing.
|
||||
*/
|
||||
public class NaturalKeyQueryData<T> {
|
||||
public final class NaturalKeyQueryData<T> {
|
||||
|
||||
private final BeanNaturalKey naturalKey;
|
||||
|
||||
/**
|
||||
* Only one of IN or IN PAIRS is allowed.
|
||||
*/
|
||||
private boolean hasIn;
|
||||
|
||||
// IN Pairs clause - only one allowed
|
||||
private String inProperty0, inProperty1;
|
||||
private List<Pairs.Entry> inPairs;
|
||||
|
||||
// IN clause - only one allowed
|
||||
private List<Object> inValues;
|
||||
private String inProperty;
|
||||
|
||||
// normal EQ expressions
|
||||
private List<NaturalKeyEq> eqList;
|
||||
|
||||
private NaturalKeySet set;
|
||||
|
||||
private int hitCount;
|
||||
|
||||
public NaturalKeyQueryData(BeanNaturalKey naturalKey) {
|
||||
|
||||
@@ -4,8 +4,7 @@ import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class NaturalKeySet {
|
||||
|
||||
public final class NaturalKeySet {
|
||||
|
||||
private final Map<Object, NaturalKeyEntry> map = new LinkedHashMap<>();
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package io.ebeaninternal.api;
|
||||
|
||||
import io.ebeaninternal.server.type.bindcapture.BindCapture;
|
||||
|
||||
class NoopQueryBindCapture implements SpiQueryBindCapture {
|
||||
final class NoopQueryBindCapture implements SpiQueryBindCapture {
|
||||
|
||||
@Override
|
||||
public boolean collectFor(long timeMicros) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import io.ebean.meta.QueryPlanRequest;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
class NoopQueryPlanManager implements QueryPlanManager {
|
||||
final class NoopQueryPlanManager implements QueryPlanManager {
|
||||
|
||||
@Override
|
||||
public void setDefaultThreshold(long thresholdMicros) {
|
||||
|
||||
@@ -3,7 +3,7 @@ package io.ebeaninternal.api;
|
||||
import io.ebean.annotation.Platform;
|
||||
import io.ebean.util.StringHelper;
|
||||
|
||||
public class PlatformMatch {
|
||||
public final class PlatformMatch {
|
||||
|
||||
/**
|
||||
* Return true if the script platforms is a match/supported for the given platform.
|
||||
@@ -15,7 +15,6 @@ public class PlatformMatch {
|
||||
if (platforms == null || platforms.trim().isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// match on base platform name and platform name
|
||||
for (String name : StringHelper.splitNames(platforms)) {
|
||||
if (name.equalsIgnoreCase(platform.base().name()) || name.equalsIgnoreCase(platform.name())) {
|
||||
|
||||
@@ -5,16 +5,9 @@ import io.ebeaninternal.server.query.SqlJoinType;
|
||||
/**
|
||||
* Represents a join required for a given property and whether than needs to be an outer join.
|
||||
*/
|
||||
public class PropertyJoin {
|
||||
public final class PropertyJoin {
|
||||
|
||||
/**
|
||||
* The property name.
|
||||
*/
|
||||
private final String property;
|
||||
|
||||
/**
|
||||
* Set to true if the property needs to be an outer join.
|
||||
*/
|
||||
private final SqlJoinType joinType;
|
||||
|
||||
public PropertyJoin(String property, SqlJoinType joinType) {
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.util.ArrayList;
|
||||
/**
|
||||
* Used internally to handle the scoping of transactions for methods.
|
||||
*/
|
||||
public class ScopeTrans {
|
||||
public final class ScopeTrans {
|
||||
|
||||
private static final int OPCODE_ATHROW = 191;
|
||||
|
||||
@@ -15,43 +15,32 @@ public class ScopeTrans {
|
||||
* The transaction in scope (can be null).
|
||||
*/
|
||||
private final SpiTransaction transaction;
|
||||
|
||||
/**
|
||||
* If true by default rollback on Checked exceptions.
|
||||
*/
|
||||
private final boolean rollbackOnChecked;
|
||||
|
||||
/**
|
||||
* True if the transaction was created and hence should be committed
|
||||
* on finally if it hasn't already been rolled back.
|
||||
*/
|
||||
private final boolean created;
|
||||
|
||||
/**
|
||||
* Explicit set of Exceptions that DO NOT cause a rollback to occur.
|
||||
*/
|
||||
private final ArrayList<Class<? extends Throwable>> noRollbackFor;
|
||||
|
||||
/**
|
||||
* Explicit set of Exceptions that DO cause a rollback to occur.
|
||||
*/
|
||||
private final ArrayList<Class<? extends Throwable>> rollbackFor;
|
||||
|
||||
private Boolean restoreBatch;
|
||||
|
||||
private Boolean restoreBatchOnCascade;
|
||||
|
||||
private int restoreBatchSize;
|
||||
|
||||
private Boolean restoreBatchGeneratedKeys;
|
||||
|
||||
private boolean restoreBatchFlushOnQuery;
|
||||
|
||||
/**
|
||||
* Flag set when a rollback has occurred.
|
||||
*/
|
||||
private boolean rolledBack;
|
||||
|
||||
/**
|
||||
* Flag set when nested commit has occurred.
|
||||
*/
|
||||
|
||||
@@ -10,15 +10,13 @@ import javax.persistence.PersistenceException;
|
||||
*
|
||||
* These can be nested and internally they are pushed and popped from a stack.
|
||||
*/
|
||||
public class ScopedTransaction extends SpiTransactionProxy {
|
||||
public final class ScopedTransaction extends SpiTransactionProxy {
|
||||
|
||||
private final TransactionScopeManager manager;
|
||||
|
||||
/**
|
||||
* Stack of 'nested' transactions.
|
||||
*/
|
||||
private final ArrayStack<ScopeTrans> stack = new ArrayStack<>();
|
||||
|
||||
private ScopeTrans current;
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,10 +8,9 @@ import java.util.Set;
|
||||
/**
|
||||
* Property expression validation request for a given root bean type.
|
||||
*/
|
||||
public class SpiExpressionValidation {
|
||||
public final class SpiExpressionValidation {
|
||||
|
||||
private final BeanType<?> desc;
|
||||
|
||||
private final LinkedHashSet<String> unknown = new LinkedHashSet<>();
|
||||
|
||||
public SpiExpressionValidation(BeanType<?> desc) {
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.util.List;
|
||||
* to the TransactionEventManager.
|
||||
* </p>
|
||||
*/
|
||||
public class TransactionEvent implements Serializable {
|
||||
public final class TransactionEvent implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 7230903304106097120L;
|
||||
|
||||
@@ -29,13 +29,9 @@ public class TransactionEvent implements Serializable {
|
||||
* the cluster).
|
||||
*/
|
||||
private final transient boolean local;
|
||||
|
||||
private TransactionEventTable eventTables;
|
||||
|
||||
private transient List<PersistRequestBean<?>> listenerNotify;
|
||||
|
||||
private transient DeleteByIdMap deleteByIdMap;
|
||||
|
||||
private transient CacheChangeSet changeSet;
|
||||
|
||||
/**
|
||||
@@ -110,11 +106,9 @@ public class TransactionEvent implements Serializable {
|
||||
* Build and return the cache changeSet.
|
||||
*/
|
||||
public CacheChangeSet buildCacheChanges(TransactionManager manager) {
|
||||
|
||||
if (changeSet == null && deleteByIdMap == null && eventTables == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (changeSet == null) {
|
||||
changeSet = new CacheChangeSet();
|
||||
}
|
||||
|
||||
@@ -28,20 +28,17 @@ public final class TransactionEventTable implements Serializable, BinaryWritable
|
||||
}
|
||||
|
||||
public void add(TransactionEventTable table) {
|
||||
|
||||
for (TableIUD iud : table.values()) {
|
||||
add(iud);
|
||||
}
|
||||
}
|
||||
|
||||
public void add(String table, boolean insert, boolean update, boolean delete) {
|
||||
|
||||
table = table.toUpperCase();
|
||||
add(new TableIUD(table, insert, update, delete));
|
||||
}
|
||||
|
||||
public void add(TableIUD newTableIUD) {
|
||||
|
||||
TableIUD existingTableIUD = map.put(newTableIUD.getTableName(), newTableIUD);
|
||||
if (existingTableIUD != null) {
|
||||
newTableIUD.add(existingTableIUD);
|
||||
@@ -56,7 +53,7 @@ public final class TransactionEventTable implements Serializable, BinaryWritable
|
||||
return map.values();
|
||||
}
|
||||
|
||||
public static class TableIUD implements Serializable, BulkTableEvent, BinaryWritable {
|
||||
public static final class TableIUD implements Serializable, BulkTableEvent, BinaryWritable {
|
||||
|
||||
private static final long serialVersionUID = -1958317571064162089L;
|
||||
|
||||
@@ -73,12 +70,10 @@ public final class TransactionEventTable implements Serializable, BinaryWritable
|
||||
}
|
||||
|
||||
public static TableIUD readBinaryMessage(BinaryReadContext dataInput) throws IOException {
|
||||
|
||||
String table = dataInput.readUTF();
|
||||
boolean insert = dataInput.readBoolean();
|
||||
boolean update = dataInput.readBoolean();
|
||||
boolean delete = dataInput.readBoolean();
|
||||
|
||||
return new TableIUD(table, insert, update, delete);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import java.util.Set;
|
||||
/**
|
||||
* Utility that converts between JSON content and simple java Maps/Lists.
|
||||
*/
|
||||
public class DJsonService implements SpiJsonService {
|
||||
public final class DJsonService implements SpiJsonService {
|
||||
|
||||
/**
|
||||
* Write the nested Map/List as json.
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
class EJsonReader {
|
||||
final class EJsonReader {
|
||||
|
||||
static final JsonFactory json = new JsonFactory();
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
class EJsonWriter {
|
||||
final class EJsonWriter {
|
||||
|
||||
/**
|
||||
* Base jsonFactory implementation used when it is not passed in.
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.io.Serializable;
|
||||
/**
|
||||
* Detects when content has been modified and as such needs to be persisted (included in an update).
|
||||
*/
|
||||
public class ModifyAwareFlag implements ModifyAwareType, Serializable {
|
||||
public final class ModifyAwareFlag implements ModifyAwareType, Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1;
|
||||
|
||||
|
||||
@@ -7,10 +7,9 @@ import java.util.Iterator;
|
||||
/**
|
||||
* Wraps an iterator for the purposes of detecting modifications.
|
||||
*/
|
||||
public class ModifyAwareIterator<E> implements Iterator<E> {
|
||||
public final class ModifyAwareIterator<E> implements Iterator<E> {
|
||||
|
||||
private final ModifyAwareType owner;
|
||||
|
||||
private final Iterator<E> it;
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,12 +13,11 @@ import java.util.Objects;
|
||||
/**
|
||||
* Modify aware wrapper of a list.
|
||||
*/
|
||||
public class ModifyAwareList<E> implements List<E>, ModifyAwareType, Serializable {
|
||||
public final class ModifyAwareList<E> implements List<E>, ModifyAwareType, Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1;
|
||||
|
||||
final List<E> list;
|
||||
|
||||
final ModifyAwareType owner;
|
||||
|
||||
public ModifyAwareList(List<E> list) {
|
||||
|
||||
@@ -7,10 +7,9 @@ import java.util.ListIterator;
|
||||
/**
|
||||
* Modify aware wrapper of a ListIterator.
|
||||
*/
|
||||
public class ModifyAwareListIterator<E> implements ListIterator<E> {
|
||||
public final class ModifyAwareListIterator<E> implements ListIterator<E> {
|
||||
|
||||
final ModifyAwareType owner;
|
||||
|
||||
final ListIterator<E> iterator;
|
||||
|
||||
public ModifyAwareListIterator(ModifyAwareType owner, ListIterator<E> iterator) {
|
||||
|
||||
@@ -12,15 +12,11 @@ import java.util.Set;
|
||||
/**
|
||||
* Map that is wraps an underlying map for the purpose of detecting changes.
|
||||
*/
|
||||
public class ModifyAwareMap<K, V> implements Map<K, V>, ModifyAwareType, Serializable {
|
||||
public final class ModifyAwareMap<K, V> implements Map<K, V>, ModifyAwareType, Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1;
|
||||
|
||||
final ModifyAwareType owner;
|
||||
|
||||
/**
|
||||
* The underlying map.
|
||||
*/
|
||||
final Map<K, V> map;
|
||||
|
||||
public ModifyAwareMap(Map<K, V> underlying) {
|
||||
|
||||
@@ -11,13 +11,12 @@ import java.util.Set;
|
||||
/**
|
||||
* Wraps a Set for the purposes of detecting modifications.
|
||||
*/
|
||||
public class ModifyAwareSet<E> implements Set<E>, ModifyAwareType, Serializable {
|
||||
public final class ModifyAwareSet<E> implements Set<E>, ModifyAwareType, Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1;
|
||||
|
||||
protected final ModifyAwareType owner;
|
||||
|
||||
protected final Set<E> set;
|
||||
private final ModifyAwareType owner;
|
||||
private final Set<E> set;
|
||||
|
||||
/**
|
||||
* Create as top level with it's own ModifyAwareOwner instance wrapping the given Set.
|
||||
|
||||
@@ -8,7 +8,7 @@ import io.ebeaninternal.server.core.DefaultContainer;
|
||||
/**
|
||||
* Default container factory found via service loader.
|
||||
*/
|
||||
public class DContainerFactory implements SpiContainerFactory {
|
||||
public final class DContainerFactory implements SpiContainerFactory {
|
||||
|
||||
@Override
|
||||
public SpiContainer create(ContainerConfig containerConfig) {
|
||||
|
||||
@@ -5,7 +5,7 @@ import io.ebeaninternal.api.SpiQuery;
|
||||
/**
|
||||
* Noop service when AutoTuneService is not available.
|
||||
*/
|
||||
public class NoAutoTuneService implements AutoTuneService {
|
||||
public final class NoAutoTuneService implements AutoTuneService {
|
||||
|
||||
@Override
|
||||
public void startup() {
|
||||
|
||||
+1
-2
@@ -8,10 +8,9 @@ import java.util.Collection;
|
||||
/**
|
||||
* Change to remove bean from L2 cache.
|
||||
*/
|
||||
class CacheChangeBeanRemove implements CacheChange {
|
||||
final class CacheChangeBeanRemove implements CacheChange {
|
||||
|
||||
private final BeanDescriptor<?> descriptor;
|
||||
|
||||
private final Collection<Object> ids;
|
||||
|
||||
CacheChangeBeanRemove(Object id, BeanDescriptor<?> descriptor) {
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import java.util.Map;
|
||||
/**
|
||||
* Put a new bean entry into the cache.
|
||||
*/
|
||||
class CacheChangeBeanUpdate implements CacheChange {
|
||||
final class CacheChangeBeanUpdate implements CacheChange {
|
||||
|
||||
private final BeanDescriptor<?> desc;
|
||||
private final String key;
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import io.ebeaninternal.server.deploy.BeanDescriptor;
|
||||
/**
|
||||
* Change the natural key mapping for a bean.
|
||||
*/
|
||||
class CacheChangeNaturalKeyPut implements CacheChange {
|
||||
final class CacheChangeNaturalKeyPut implements CacheChange {
|
||||
|
||||
private final BeanDescriptor<?> descriptor;
|
||||
private final String key;
|
||||
|
||||
+3
-12
@@ -14,18 +14,13 @@ import java.util.Set;
|
||||
/**
|
||||
* List of changes to be applied to L2 cache.
|
||||
*/
|
||||
public class CacheChangeSet {
|
||||
public final class CacheChangeSet {
|
||||
|
||||
private final List<CacheChange> entries = new ArrayList<>();
|
||||
|
||||
private final Set<String> touchedTables = new HashSet<>();
|
||||
|
||||
private final Set<BeanDescriptor<?>> queryCaches = new HashSet<>();
|
||||
|
||||
private final Set<BeanDescriptor<?>> beanCaches = new HashSet<>();
|
||||
|
||||
private final Map<BeanDescriptor<?>, CacheChangeBeanRemove> beanRemoveMap = new HashMap<>();
|
||||
|
||||
private final Map<ManyKey, ManyChange> manyChangeMap = new HashMap<>();
|
||||
|
||||
/**
|
||||
@@ -173,14 +168,11 @@ public class CacheChangeSet {
|
||||
/**
|
||||
* Changes for a specific many property.
|
||||
*/
|
||||
private static class ManyChange implements CacheChange {
|
||||
private static final class ManyChange implements CacheChange {
|
||||
|
||||
final ManyKey key;
|
||||
|
||||
final Set<Object> removes = new HashSet<>();
|
||||
|
||||
final Map<Object, CachedManyIds> puts = new LinkedHashMap<>();
|
||||
|
||||
boolean clear;
|
||||
|
||||
ManyChange(ManyKey key) {
|
||||
@@ -229,10 +221,9 @@ public class CacheChangeSet {
|
||||
/**
|
||||
* Key for changes on a many property.
|
||||
*/
|
||||
private static class ManyKey {
|
||||
private static final class ManyKey {
|
||||
|
||||
private final BeanDescriptor<?> desc;
|
||||
|
||||
private final String manyProperty;
|
||||
|
||||
ManyKey(BeanDescriptor<?> desc, String manyProperty) {
|
||||
|
||||
+1
-6
@@ -10,18 +10,13 @@ import io.ebeaninternal.server.cluster.ClusterManager;
|
||||
/**
|
||||
* Configuration options when creating the default cache manager.
|
||||
*/
|
||||
public class CacheManagerOptions {
|
||||
public final class CacheManagerOptions {
|
||||
|
||||
private final ClusterManager clusterManager;
|
||||
|
||||
private final DatabaseConfig databaseConfig;
|
||||
|
||||
private final boolean localL2Caching;
|
||||
|
||||
private CurrentTenantProvider currentTenantProvider;
|
||||
|
||||
private QueryCacheEntryValidate queryCacheEntryValidate;
|
||||
|
||||
private ServerCacheFactory cacheFactory = new DefaultServerCacheFactory();
|
||||
private ServerCacheOptions beanDefault = new ServerCacheOptions();
|
||||
private ServerCacheOptions queryDefault = new ServerCacheOptions();
|
||||
|
||||
@@ -11,13 +11,12 @@ import java.util.Map;
|
||||
/**
|
||||
* Data held in the bean cache for cached beans.
|
||||
*/
|
||||
public class CachedBeanData implements Externalizable {
|
||||
public final class CachedBeanData implements Externalizable {
|
||||
|
||||
private long whenCreated;
|
||||
private long version;
|
||||
private String discValue;
|
||||
private Map<String, Object> data;
|
||||
|
||||
/**
|
||||
* The sharable bean is effectively transient (near cache only).
|
||||
*/
|
||||
|
||||
+1
-3
@@ -9,10 +9,9 @@ import io.ebeaninternal.server.deploy.BeanPropertyAssocMany;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class CachedBeanDataFromBean {
|
||||
public final class CachedBeanDataFromBean {
|
||||
|
||||
public static CachedBeanData extract(BeanDescriptor<?> desc, EntityBean bean) {
|
||||
|
||||
EntityBeanIntercept ebi = bean._ebean_getIntercept();
|
||||
Map<String, Object> data = new LinkedHashMap<>();
|
||||
|
||||
@@ -46,7 +45,6 @@ public class CachedBeanDataFromBean {
|
||||
}
|
||||
|
||||
private static EntityBean createSharableBean(BeanDescriptor<?> desc, EntityBean bean, EntityBeanIntercept beanEbi) {
|
||||
|
||||
if (!desc.isCacheSharableBeans() || !beanEbi.isFullyLoadedBean()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
+1
-9
@@ -7,30 +7,24 @@ import io.ebeaninternal.server.deploy.BeanDescriptor;
|
||||
import io.ebeaninternal.server.deploy.BeanProperty;
|
||||
import io.ebeaninternal.server.deploy.BeanPropertyAssocMany;
|
||||
|
||||
public class CachedBeanDataToBean {
|
||||
|
||||
public final class CachedBeanDataToBean {
|
||||
|
||||
public static void load(BeanDescriptor<?> desc, EntityBean bean, CachedBeanData cacheBeanData, PersistenceContext context) {
|
||||
|
||||
EntityBeanIntercept ebi = bean._ebean_getIntercept();
|
||||
// any future lazy loading skips L2 bean cache
|
||||
ebi.setLoadedFromCache(true);
|
||||
|
||||
BeanProperty idProperty = desc.getIdProperty();
|
||||
if (desc.getInheritInfo() != null) {
|
||||
desc = desc.getInheritInfo().readType(bean.getClass()).desc();
|
||||
}
|
||||
|
||||
if (idProperty != null) {
|
||||
// load the id property
|
||||
loadProperty(bean, cacheBeanData, ebi, idProperty, context);
|
||||
}
|
||||
|
||||
// load the non-many properties
|
||||
for (BeanProperty prop : desc.propertiesNonMany()) {
|
||||
loadProperty(bean, cacheBeanData, ebi, prop, context);
|
||||
}
|
||||
|
||||
for (BeanPropertyAssocMany<?> prop : desc.propertiesMany()) {
|
||||
if (prop.isElementCollection()) {
|
||||
loadProperty(bean, cacheBeanData, ebi, prop, context);
|
||||
@@ -38,12 +32,10 @@ public class CachedBeanDataToBean {
|
||||
prop.createReferenceIfNull(bean);
|
||||
}
|
||||
}
|
||||
|
||||
ebi.setLoadedLazy();
|
||||
}
|
||||
|
||||
private static void loadProperty(EntityBean bean, CachedBeanData cacheBeanData, EntityBeanIntercept ebi, BeanProperty prop, PersistenceContext context) {
|
||||
|
||||
if (cacheBeanData.isLoaded(prop.getName())) {
|
||||
if (!ebi.isLoadedProperty(prop.getPropertyIndex())) {
|
||||
Object value = cacheBeanData.getData(prop.getName());
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.io.ObjectOutput;
|
||||
* <p>
|
||||
* Put into L2 cache such that we know the type of a bean with inheritance.
|
||||
*/
|
||||
public class CachedBeanId implements Externalizable {
|
||||
public final class CachedBeanId implements Externalizable {
|
||||
|
||||
private String discValue;
|
||||
private Object id;
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.util.List;
|
||||
* This is effectively just the Id values for each of the beans in the collection.
|
||||
* </p>
|
||||
*/
|
||||
public class CachedManyIds implements Externalizable {
|
||||
public final class CachedManyIds implements Externalizable {
|
||||
|
||||
private List<Object> idList;
|
||||
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ import java.util.List;
|
||||
* Used to hide the Supplier part of the SpiCacheManager API from public use.
|
||||
* </p>
|
||||
*/
|
||||
public class DefaultCacheAdapter implements ServerCacheManager {
|
||||
public final class DefaultCacheAdapter implements ServerCacheManager {
|
||||
|
||||
private final SpiCacheManager cacheManager;
|
||||
|
||||
|
||||
+1
-5
@@ -23,14 +23,13 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
/**
|
||||
* Manages the construction of caches.
|
||||
*/
|
||||
class DefaultCacheHolder {
|
||||
final class DefaultCacheHolder {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger("io.ebean.cache.ALL");
|
||||
|
||||
private final ReentrantLock lock = new ReentrantLock();
|
||||
private final ConcurrentHashMap<String, ServerCache> allCaches = new ConcurrentHashMap<>();
|
||||
private final ConcurrentHashMap<String, Set<String>> collectIdCaches = new ConcurrentHashMap<>();
|
||||
|
||||
private final ServerCacheFactory cacheFactory;
|
||||
private final ServerCacheOptions beanDefault;
|
||||
private final ServerCacheOptions queryDefault;
|
||||
@@ -76,7 +75,6 @@ class DefaultCacheHolder {
|
||||
* Return the cache for a given bean type.
|
||||
*/
|
||||
private ServerCache getCacheInternal(Class<?> beanType, ServerCacheType type, String collectionProperty) {
|
||||
|
||||
String shortName = key(beanType.getSimpleName(), collectionProperty, type);
|
||||
String fullKey = key(beanType.getName(), collectionProperty, type);
|
||||
return allCaches.computeIfAbsent(fullKey, s -> createCache(beanType, type, fullKey, shortName));
|
||||
@@ -143,10 +141,8 @@ class DefaultCacheHolder {
|
||||
}
|
||||
|
||||
private ServerCacheOptions getBeanOptions(Class<?> cls) {
|
||||
|
||||
Cache cache = cls.getAnnotation(Cache.class);
|
||||
boolean nearCache = (cache != null && cache.nearCache());
|
||||
|
||||
CacheBeanTuning tuning = cls.getAnnotation(CacheBeanTuning.class);
|
||||
if (tuning != null) {
|
||||
return new ServerCacheOptions(nearCache, tuning).applyDefaults(beanDefault);
|
||||
|
||||
+7
-32
@@ -39,7 +39,6 @@ public class DefaultServerCache implements ServerCache {
|
||||
* The underlying map (ConcurrentHashMap or similar)
|
||||
*/
|
||||
protected final Map<Object, SoftReference<CacheEntry>> map;
|
||||
|
||||
protected final CountMetric hitCount;
|
||||
protected final CountMetric missCount;
|
||||
protected final CountMetric putCount;
|
||||
@@ -49,16 +48,11 @@ public class DefaultServerCache implements ServerCache {
|
||||
|
||||
protected final String name;
|
||||
protected final String shortName;
|
||||
|
||||
private int maxSize;
|
||||
|
||||
private final int maxSize;
|
||||
private final int trimFrequency;
|
||||
|
||||
private int maxIdleSecs;
|
||||
|
||||
private int maxSecsToLive;
|
||||
|
||||
private TenantAwareKey tenantAwareKey;
|
||||
private final int maxIdleSecs;
|
||||
private final int maxSecsToLive;
|
||||
private final TenantAwareKey tenantAwareKey;
|
||||
|
||||
public DefaultServerCache(DefaultServerCacheConfig config) {
|
||||
this.name = config.getName();
|
||||
@@ -71,7 +65,6 @@ public class DefaultServerCache implements ServerCache {
|
||||
this.trimFrequency = config.determineTrimFrequency();
|
||||
|
||||
MetricFactory factory = MetricFactory.get();
|
||||
|
||||
String prefix = "l2n.";
|
||||
this.hitCount = factory.createCountMetric(prefix + shortName + ".hit");
|
||||
this.missCount = factory.createCountMetric(prefix + shortName + ".miss");
|
||||
@@ -82,9 +75,7 @@ public class DefaultServerCache implements ServerCache {
|
||||
}
|
||||
|
||||
public void periodicTrim(BackgroundExecutor executor) {
|
||||
|
||||
EvictionRunnable trim = new EvictionRunnable();
|
||||
|
||||
// default to trimming the cache every 60 seconds
|
||||
long trimFreqSecs = (trimFrequency == 0) ? 60 : trimFrequency;
|
||||
executor.scheduleWithFixedDelay(trim, trimFreqSecs, trimFreqSecs, TimeUnit.SECONDS);
|
||||
@@ -102,11 +93,9 @@ public class DefaultServerCache implements ServerCache {
|
||||
|
||||
@Override
|
||||
public ServerCacheStatistics getStatistics(boolean reset) {
|
||||
|
||||
ServerCacheStatistics cacheStats = new ServerCacheStatistics();
|
||||
cacheStats.setCacheName(name);
|
||||
cacheStats.setMaxSize(maxSize);
|
||||
|
||||
cacheStats.setSize(size());
|
||||
cacheStats.setHitCount(hitCount.get(reset));
|
||||
cacheStats.setMissCount(missCount.get(reset));
|
||||
@@ -114,7 +103,6 @@ public class DefaultServerCache implements ServerCache {
|
||||
cacheStats.setRemoveCount(removeCount.get(reset));
|
||||
cacheStats.setClearCount(clearCount.get(reset));
|
||||
cacheStats.setEvictCount(evictCount.get(reset));
|
||||
|
||||
return cacheStats;
|
||||
}
|
||||
|
||||
@@ -134,10 +122,8 @@ public class DefaultServerCache implements ServerCache {
|
||||
|
||||
@Override
|
||||
public int getHitRatio() {
|
||||
|
||||
long mc = missCount.get(false);
|
||||
long hc = hitCount.get(false);
|
||||
|
||||
long totalCount = hc + mc;
|
||||
if (totalCount == 0) {
|
||||
return 0;
|
||||
@@ -178,7 +164,6 @@ public class DefaultServerCache implements ServerCache {
|
||||
*/
|
||||
@Override
|
||||
public Object get(Object id) {
|
||||
|
||||
CacheEntry entry = getCacheEntry(id);
|
||||
if (entry == null) {
|
||||
missCount.increment();
|
||||
@@ -252,31 +237,25 @@ public class DefaultServerCache implements ServerCache {
|
||||
* Run the eviction based on Idle time, Time to live and LRU last access.
|
||||
*/
|
||||
public void runEviction() {
|
||||
|
||||
long trimForMaxSize;
|
||||
if (maxSize == 0) {
|
||||
trimForMaxSize = 0;
|
||||
} else {
|
||||
trimForMaxSize = size() - maxSize;
|
||||
}
|
||||
|
||||
if (maxIdleSecs == 0 && maxSecsToLive == 0 && trimForMaxSize < 0) {
|
||||
// nothing to trim on this cache
|
||||
return;
|
||||
}
|
||||
|
||||
long startNanos = System.nanoTime();
|
||||
|
||||
long trimmedByIdle = 0;
|
||||
long trimmedByGC = 0;
|
||||
long trimmedByTTL = 0;
|
||||
long trimmedByLRU = 0;
|
||||
|
||||
List<CacheEntry> activeList = new ArrayList<>(map.size());
|
||||
|
||||
long idleExpireNano = startNanos - TimeUnit.SECONDS.toNanos(maxIdleSecs);
|
||||
long ttlExpireNano = startNanos - TimeUnit.SECONDS.toNanos(maxSecsToLive);
|
||||
|
||||
Iterator<SoftReference<CacheEntry>> it = map.values().iterator();
|
||||
while (it.hasNext()) {
|
||||
SoftReference<CacheEntry> ref = it.next();
|
||||
@@ -287,16 +266,13 @@ public class DefaultServerCache implements ServerCache {
|
||||
} else if (maxIdleSecs > 0 && idleExpireNano > cacheEntry.getLastAccessTime()) {
|
||||
it.remove();
|
||||
trimmedByIdle++;
|
||||
|
||||
} else if (maxSecsToLive > 0 && ttlExpireNano > cacheEntry.getCreateTime()) {
|
||||
it.remove();
|
||||
trimmedByTTL++;
|
||||
|
||||
} else if (trimForMaxSize > 0) {
|
||||
activeList.add(cacheEntry);
|
||||
}
|
||||
}
|
||||
|
||||
if (trimForMaxSize > 0 && activeList.size() > maxSize) {
|
||||
// sort into last access time ascending
|
||||
activeList.sort(BY_LAST_ACCESS);
|
||||
@@ -313,7 +289,6 @@ public class DefaultServerCache implements ServerCache {
|
||||
evictCount.add(trimmedByGC);
|
||||
evictCount.add(trimmedByTTL);
|
||||
evictCount.add(trimmedByLRU);
|
||||
|
||||
if (logger.isTraceEnabled()) {
|
||||
long exeMicros = TimeUnit.MICROSECONDS.convert(System.nanoTime() - startNanos, TimeUnit.NANOSECONDS);
|
||||
logger.trace("Executed trim of cache {} in [{}]millis idle[{}] timeToLive[{}] accessTime[{}] gc[{}]",
|
||||
@@ -324,7 +299,7 @@ public class DefaultServerCache implements ServerCache {
|
||||
/**
|
||||
* Runnable that calls the eviction routine.
|
||||
*/
|
||||
public class EvictionRunnable implements Runnable {
|
||||
public final class EvictionRunnable implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -335,7 +310,7 @@ public class DefaultServerCache implements ServerCache {
|
||||
/**
|
||||
* Comparator for sorting by last access time.
|
||||
*/
|
||||
public static class CompareByLastAccess implements Comparator<CacheEntry>, Serializable {
|
||||
public static final class CompareByLastAccess implements Comparator<CacheEntry>, Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -348,7 +323,7 @@ public class DefaultServerCache implements ServerCache {
|
||||
/**
|
||||
* Wraps the value to additionally hold createTime and lastAccessTime and hit counter.
|
||||
*/
|
||||
public static class CacheEntry {
|
||||
public static final class CacheEntry {
|
||||
|
||||
private final Object key;
|
||||
private final Object value;
|
||||
|
||||
+6
-8
@@ -10,16 +10,14 @@ import java.lang.ref.SoftReference;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class DefaultServerCacheConfig {
|
||||
public final class DefaultServerCacheConfig {
|
||||
|
||||
private final ServerCacheConfig config;
|
||||
|
||||
private int maxSize;
|
||||
private int maxIdleSecs;
|
||||
private int maxSecsToLive;
|
||||
private int trimFrequency;
|
||||
|
||||
private Map<Object, SoftReference<CacheEntry>> map;
|
||||
private final int maxSize;
|
||||
private final int maxIdleSecs;
|
||||
private final int maxSecsToLive;
|
||||
private final int trimFrequency;
|
||||
private final Map<Object, SoftReference<CacheEntry>> map;
|
||||
|
||||
public DefaultServerCacheConfig(ServerCacheConfig config) {
|
||||
this(config, new ConcurrentHashMap<>());
|
||||
|
||||
+1
-2
@@ -11,7 +11,7 @@ import io.ebean.cache.ServerCacheNotify;
|
||||
/**
|
||||
* Default implementation of ServerCacheFactory.
|
||||
*/
|
||||
class DefaultServerCacheFactory implements ServerCacheFactory {
|
||||
final class DefaultServerCacheFactory implements ServerCacheFactory {
|
||||
|
||||
private final BackgroundExecutor executor;
|
||||
|
||||
@@ -31,7 +31,6 @@ class DefaultServerCacheFactory implements ServerCacheFactory {
|
||||
|
||||
@Override
|
||||
public ServerCache createCache(ServerCacheConfig config) {
|
||||
|
||||
DefaultServerCache cache;
|
||||
if (config.isQueryCache()) {
|
||||
// use a server cache aware of extra validation and QueryCacheEntry
|
||||
|
||||
+1
-5
@@ -19,18 +19,14 @@ import java.util.Map;
|
||||
/**
|
||||
* Manages the bean and query caches.
|
||||
*/
|
||||
public class DefaultServerCacheManager implements SpiCacheManager {
|
||||
public final class DefaultServerCacheManager implements SpiCacheManager {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger("io.ebean.cache.REGION");
|
||||
|
||||
private final Map<String, SpiCacheRegion> regionMap = new HashMap<>();
|
||||
|
||||
private final ClusterManager clusterManager;
|
||||
|
||||
private final DefaultCacheHolder cacheHolder;
|
||||
|
||||
private final boolean localL2Caching;
|
||||
|
||||
private final String serverName;
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import io.ebean.config.DatabaseConfig;
|
||||
/**
|
||||
* Default implementation of ServerCachePlugin.
|
||||
*/
|
||||
public class DefaultServerCachePlugin implements ServerCachePlugin {
|
||||
public final class DefaultServerCachePlugin implements ServerCachePlugin {
|
||||
|
||||
/**
|
||||
* Creates the default ServerCacheFactory.
|
||||
|
||||
+3
-7
@@ -12,11 +12,10 @@ import java.util.List;
|
||||
/**
|
||||
* Cache events broadcast across the cluster.
|
||||
*/
|
||||
public class RemoteCacheEvent implements BinaryWritable {
|
||||
public final class RemoteCacheEvent implements BinaryWritable {
|
||||
|
||||
private boolean clearAll;
|
||||
|
||||
private List<String> clearCaches;
|
||||
private final boolean clearAll;
|
||||
private final List<String> clearCaches;
|
||||
|
||||
/**
|
||||
* Clear all the caches.
|
||||
@@ -57,10 +56,8 @@ public class RemoteCacheEvent implements BinaryWritable {
|
||||
}
|
||||
|
||||
public static RemoteCacheEvent readBinaryMessage(BinaryReadContext dataInput) throws IOException {
|
||||
|
||||
boolean clearAll = dataInput.readBoolean();
|
||||
int size = dataInput.readInt();
|
||||
|
||||
List<String> clearCache = null;
|
||||
if (size > 0) {
|
||||
clearCache = new ArrayList<>(size);
|
||||
@@ -68,7 +65,6 @@ public class RemoteCacheEvent implements BinaryWritable {
|
||||
clearCache.add(dataInput.readUTF());
|
||||
}
|
||||
}
|
||||
|
||||
return new RemoteCacheEvent(clearAll, clearCache);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,21 +14,14 @@ import java.util.Map;
|
||||
/**
|
||||
* Builds JSON document for a bean change.
|
||||
*/
|
||||
class ChangeJsonBuilder {
|
||||
final class ChangeJsonBuilder {
|
||||
|
||||
protected final JsonFactory jsonFactory = new JsonFactory();
|
||||
|
||||
protected final JsonContext json;
|
||||
|
||||
ChangeJsonBuilder(JsonContext json) {
|
||||
this.json = json;
|
||||
}
|
||||
private final JsonFactory jsonFactory = new JsonFactory();
|
||||
|
||||
/**
|
||||
* Write the bean change as JSON.
|
||||
*/
|
||||
void writeBeanJson(Writer writer, BeanChange bean, ChangeSet changeSet) throws IOException {
|
||||
|
||||
try (JsonGenerator generator = jsonFactory.createGenerator(writer)) {
|
||||
writeBeanChange(generator, bean, changeSet);
|
||||
generator.flush();
|
||||
@@ -39,9 +32,7 @@ class ChangeJsonBuilder {
|
||||
* Write the bean change as JSON document containing the transaction header details.
|
||||
*/
|
||||
private void writeBeanChange(JsonGenerator gen, BeanChange bean, ChangeSet changeSet) throws IOException {
|
||||
|
||||
gen.writeStartObject();
|
||||
|
||||
gen.writeNumberField("ts", bean.getEventTime());
|
||||
gen.writeStringField("change", bean.getEvent().getCode());
|
||||
gen.writeStringField("type", bean.getType());
|
||||
@@ -49,9 +40,7 @@ class ChangeJsonBuilder {
|
||||
if (bean.getTenantId() != null) {
|
||||
gen.writeStringField("tenantId", bean.getTenantId().toString());
|
||||
}
|
||||
|
||||
writeBeanTransactionDetails(gen, changeSet);
|
||||
|
||||
writeBeanValues(gen, bean);
|
||||
gen.writeEndObject();
|
||||
}
|
||||
@@ -60,7 +49,6 @@ class ChangeJsonBuilder {
|
||||
* Denormalise by writing the transaction header details.
|
||||
*/
|
||||
private void writeBeanTransactionDetails(JsonGenerator gen, ChangeSet changeSet) throws IOException {
|
||||
|
||||
String source = changeSet.getSource();
|
||||
if (source != null) {
|
||||
gen.writeStringField("source", source);
|
||||
@@ -87,12 +75,10 @@ class ChangeJsonBuilder {
|
||||
* For insert and update write the new/old values.
|
||||
*/
|
||||
private void writeBeanValues(JsonGenerator gen, BeanChange bean) throws IOException {
|
||||
|
||||
if (bean.getEvent() != ChangeType.DELETE) {
|
||||
gen.writeFieldName("data");
|
||||
gen.writeRaw(":");
|
||||
gen.writeRaw(bean.getData());
|
||||
|
||||
String oldData = bean.getOldData();
|
||||
if (oldData != null) {
|
||||
gen.writeRaw(",\"oldData\":");
|
||||
|
||||
+3
-4
@@ -15,12 +15,12 @@ import java.util.Properties;
|
||||
/**
|
||||
* Simply logs the change sets in JSON form to logger named <code>io.ebean.ChangeLog</code>.
|
||||
*/
|
||||
public class DefaultChangeLogListener implements ChangeLogListener, Plugin {
|
||||
public final class DefaultChangeLogListener implements ChangeLogListener, Plugin {
|
||||
|
||||
/**
|
||||
* The usual application specific logger.
|
||||
*/
|
||||
protected static final Logger logger = LoggerFactory.getLogger(DefaultChangeLogListener.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(DefaultChangeLogListener.class);
|
||||
|
||||
/**
|
||||
* The named logger we send the change set payload to. Can be externally configured as desired.
|
||||
@@ -45,8 +45,7 @@ public class DefaultChangeLogListener implements ChangeLogListener, Plugin {
|
||||
*/
|
||||
@Override
|
||||
public void configure(SpiServer server) {
|
||||
jsonBuilder = new ChangeJsonBuilder(server.json());
|
||||
|
||||
jsonBuilder = new ChangeJsonBuilder();
|
||||
Properties properties = server.getServerConfig().getProperties();
|
||||
if (properties != null) {
|
||||
String bufferSize = properties.getProperty("ebean.changeLog.bufferSize");
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import io.ebean.event.changelog.ChangeSet;
|
||||
* on the changeSet.
|
||||
* </p>
|
||||
*/
|
||||
public class DefaultChangeLogPrepare implements ChangeLogPrepare {
|
||||
public final class DefaultChangeLogPrepare implements ChangeLogPrepare {
|
||||
|
||||
/**
|
||||
* Just return true to send change set through to the logger.
|
||||
|
||||
+1
-6
@@ -14,10 +14,9 @@ import java.util.Set;
|
||||
/**
|
||||
* Default implementation of ChangeLogRegister.
|
||||
*/
|
||||
public class DefaultChangeLogRegister implements ChangeLogRegister {
|
||||
public final class DefaultChangeLogRegister implements ChangeLogRegister {
|
||||
|
||||
private static final BasicFilter INCLUDE_INSERTS = new BasicFilter(true);
|
||||
|
||||
private static final BasicFilter EXCLUDE_INSERTS = new BasicFilter(false);
|
||||
|
||||
private final boolean defaultInsertsInclude;
|
||||
@@ -31,20 +30,16 @@ public class DefaultChangeLogRegister implements ChangeLogRegister {
|
||||
|
||||
@Override
|
||||
public ChangeLogFilter getChangeFilter(Class<?> beanType) {
|
||||
|
||||
ChangeLog changeLog = getChangeLog(beanType);
|
||||
if (changeLog == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String[] updatesThatInclude = changeLog.updatesThatInclude();
|
||||
if (updatesThatInclude.length == 0) {
|
||||
return insertModeInclude(changeLog.inserts()) ? INCLUDE_INSERTS : EXCLUDE_INSERTS;
|
||||
}
|
||||
|
||||
Set<String> updateProps = new HashSet<>();
|
||||
Collections.addAll(updateProps, updatesThatInclude);
|
||||
|
||||
return new UpdateFilter(insertModeInclude(changeLog.inserts()), updateProps);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Map;
|
||||
|
||||
class DScriptRunner implements ScriptRunner {
|
||||
final class DScriptRunner implements ScriptRunner {
|
||||
|
||||
private static final String NEWLINE = "\n";
|
||||
|
||||
|
||||
@@ -26,12 +26,11 @@ import java.util.List;
|
||||
/**
|
||||
* Helper to handle lazy loading and refreshing of beans.
|
||||
*/
|
||||
class DefaultBeanLoader {
|
||||
final class DefaultBeanLoader {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(DefaultBeanLoader.class);
|
||||
|
||||
private final DefaultServer server;
|
||||
|
||||
private final boolean onIterateUseExtraTxn;
|
||||
|
||||
DefaultBeanLoader(DefaultServer server) {
|
||||
@@ -40,17 +39,14 @@ class DefaultBeanLoader {
|
||||
}
|
||||
|
||||
void loadMany(LoadManyRequest loadRequest) {
|
||||
|
||||
SpiQuery<?> query = loadRequest.createQuery(server);
|
||||
executeQuery(loadRequest, query);
|
||||
loadRequest.postLoad();
|
||||
}
|
||||
|
||||
void loadMany(BeanCollection<?> bc, boolean onlyIds) {
|
||||
|
||||
EntityBean parentBean = bc.getOwnerBean();
|
||||
String propertyName = bc.getPropertyName();
|
||||
|
||||
loadManyInternal(parentBean, propertyName, null, false, onlyIds);
|
||||
}
|
||||
|
||||
@@ -59,13 +55,10 @@ class DefaultBeanLoader {
|
||||
}
|
||||
|
||||
private void loadManyInternal(EntityBean parentBean, String propertyName, Transaction t, boolean refresh, boolean onlyIds) {
|
||||
|
||||
EntityBeanIntercept ebi = parentBean._ebean_getIntercept();
|
||||
PersistenceContext pc = ebi.getPersistenceContext();
|
||||
|
||||
BeanDescriptor<?> parentDesc = server.getBeanDescriptor(parentBean.getClass());
|
||||
BeanPropertyAssocMany<?> many = (BeanPropertyAssocMany<?>) parentDesc.getBeanProperty(propertyName);
|
||||
|
||||
BeanCollection<?> beanCollection = null;
|
||||
ExpressionList<?> filterMany = null;
|
||||
|
||||
@@ -126,7 +119,6 @@ class DefaultBeanLoader {
|
||||
}
|
||||
|
||||
server.findOne(query, t);
|
||||
|
||||
if (beanCollection != null) {
|
||||
if (beanCollection.checkEmptyLazyLoad()) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
@@ -142,7 +134,6 @@ class DefaultBeanLoader {
|
||||
* Load a batch of beans for +query or +lazy loading.
|
||||
*/
|
||||
void loadBean(LoadBeanRequest loadRequest) {
|
||||
|
||||
List<EntityBeanIntercept> batch = loadRequest.getBatch();
|
||||
if (batch.isEmpty()) {
|
||||
throw new RuntimeException("Nothing in batch?");
|
||||
@@ -190,7 +181,6 @@ class DefaultBeanLoader {
|
||||
}
|
||||
|
||||
private void refreshBeanInternal(EntityBean bean, SpiQuery.Mode mode, int embeddedOwnerIndex) {
|
||||
|
||||
EntityBeanIntercept ebi = bean._ebean_getIntercept();
|
||||
PersistenceContext pc = ebi.getPersistenceContext();
|
||||
if (Mode.REFRESH_BEAN == mode) {
|
||||
@@ -203,12 +193,10 @@ class DefaultBeanLoader {
|
||||
// lazy loading on an embedded bean property
|
||||
EntityBean embeddedOwner = (EntityBean) ebi.getEmbeddedOwner();
|
||||
int ownerIndex = ebi.getEmbeddedOwnerIndex();
|
||||
|
||||
refreshBeanInternal(embeddedOwner, mode, ownerIndex);
|
||||
}
|
||||
|
||||
Object id = desc.getId(bean);
|
||||
|
||||
if (pc == null) {
|
||||
// a reference with no existing persistenceContext
|
||||
pc = new DefaultPersistenceContext();
|
||||
@@ -216,7 +204,6 @@ class DefaultBeanLoader {
|
||||
ebi.setPersistenceContext(pc);
|
||||
}
|
||||
boolean draft = desc.isDraftInstance(bean);
|
||||
|
||||
if (embeddedOwnerIndex == -1) {
|
||||
if (desc.lazyLoadMany(ebi)) {
|
||||
return;
|
||||
@@ -246,16 +233,13 @@ class DefaultBeanLoader {
|
||||
query.setPersistenceContext(pc);
|
||||
query.setMode(mode);
|
||||
query.setId(id);
|
||||
|
||||
if (embeddedOwnerIndex > -1 || mode == Mode.REFRESH_BEAN) {
|
||||
// make sure the query doesn't use the cache
|
||||
query.setUseCache(false);
|
||||
}
|
||||
|
||||
if (ebi.isReadOnly()) {
|
||||
query.setReadOnly(true);
|
||||
}
|
||||
|
||||
if (Mode.REFRESH_BEAN == mode) {
|
||||
// explicitly state to load all properties on REFRESH.
|
||||
// Lobs default to fetch lazy so this forces lobs to be
|
||||
@@ -268,7 +252,6 @@ class DefaultBeanLoader {
|
||||
String msg = "Bean not found during lazy load or refresh." + " id[" + id + "] type[" + desc.getBeanType() + "]";
|
||||
throw new EntityNotFoundException(msg);
|
||||
}
|
||||
|
||||
desc.resetManyProperties(dbBean);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.Set;
|
||||
/**
|
||||
* Default implementation of BeanState.
|
||||
*/
|
||||
public class DefaultBeanState implements BeanState {
|
||||
public final class DefaultBeanState implements BeanState {
|
||||
|
||||
private final EntityBeanIntercept intercept;
|
||||
|
||||
@@ -94,4 +94,8 @@ public class DefaultBeanState implements BeanState {
|
||||
return intercept.getLoadErrors();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSortOrder() {
|
||||
return intercept.getSortOrder();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.util.Arrays;
|
||||
/**
|
||||
* Default CallStackFactory where the Hash function for StackTraceElement includes the line number.
|
||||
*/
|
||||
public class DefaultCallOriginFactory implements CallOriginFactory {
|
||||
public final class DefaultCallOriginFactory implements CallOriginFactory {
|
||||
|
||||
private static final int IGNORE_LEADING_ELEMENTS = 5;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.sql.CallableStatement;
|
||||
import java.sql.SQLException;
|
||||
|
||||
|
||||
public class DefaultCallableSql implements Serializable, SpiCallableSql {
|
||||
public final class DefaultCallableSql implements Serializable, SpiCallableSql {
|
||||
|
||||
private static final long serialVersionUID = 8984272253185424701L;
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
/**
|
||||
* Default Server side implementation of ServerFactory.
|
||||
*/
|
||||
public class DefaultContainer implements SpiContainer {
|
||||
public final class DefaultContainer implements SpiContainer {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger("io.ebean.DB");
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import java.util.List;
|
||||
/**
|
||||
* DefaultServer based implementation of MetaInfoManager.
|
||||
*/
|
||||
public class DefaultMetaInfoManager implements MetaInfoManager {
|
||||
final class DefaultMetaInfoManager implements MetaInfoManager {
|
||||
|
||||
private final DefaultServer server;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import io.ebean.meta.MetaQueryPlan;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
class DefaultQueryPlanListener implements QueryPlanListener {
|
||||
final class DefaultQueryPlanListener implements QueryPlanListener {
|
||||
|
||||
static final QueryPlanListener INSTANT = new DefaultQueryPlanListener();
|
||||
|
||||
|
||||
@@ -9,13 +9,12 @@ import org.slf4j.LoggerFactory;
|
||||
/**
|
||||
* Default slow query listener implementation that logs a warning message.
|
||||
*/
|
||||
class DefaultSlowQueryListener implements SlowQueryListener {
|
||||
final class DefaultSlowQueryListener implements SlowQueryListener {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger("io.ebean.SlowQuery");
|
||||
|
||||
@Override
|
||||
public void process(SlowQueryEvent event) {
|
||||
|
||||
String firstStack = "";
|
||||
ObjectGraphNode node = event.getOriginNode();
|
||||
if (node != null) {
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.Map;
|
||||
* This intentionally does not include any OneToMany or ManyToMany properties.
|
||||
* </p>
|
||||
*/
|
||||
public class DiffHelp {
|
||||
public final class DiffHelp {
|
||||
|
||||
private DiffHelp() {
|
||||
}
|
||||
@@ -28,11 +28,9 @@ public class DiffHelp {
|
||||
* </p>
|
||||
*/
|
||||
public static Map<String, ValuePair> diff(Object newBean, Object oldBean, BeanDescriptor<?> desc) {
|
||||
|
||||
if (!(newBean instanceof EntityBean)) {
|
||||
throw new IllegalArgumentException("First bean expected to be an enhanced EntityBean? bean:" + newBean);
|
||||
}
|
||||
|
||||
if (oldBean != null) {
|
||||
if (!(oldBean instanceof EntityBean)) {
|
||||
throw new IllegalArgumentException("Second bean expected to be an enhanced EntityBean? bean:" + oldBean);
|
||||
@@ -41,11 +39,9 @@ public class DiffHelp {
|
||||
throw new IllegalArgumentException("Second bean not assignable to the first bean?");
|
||||
}
|
||||
}
|
||||
|
||||
if (oldBean == null) {
|
||||
return ((EntityBean) newBean)._ebean_getIntercept().getDirtyValues();
|
||||
}
|
||||
|
||||
return desc.diff((EntityBean) newBean, (EntityBean) oldBean);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,14 +10,12 @@ import io.ebeaninternal.api.SpiEbeanServer;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
class DumpMetrics {
|
||||
final class DumpMetrics {
|
||||
|
||||
private final SpiEbeanServer server;
|
||||
private final String options;
|
||||
|
||||
private final String nameFormat;
|
||||
private final String nameFormatTimed;
|
||||
|
||||
private boolean dumpHash;
|
||||
private boolean dumpSql;
|
||||
private boolean dumpLoc;
|
||||
|
||||
@@ -14,10 +14,9 @@ import java.util.List;
|
||||
/**
|
||||
* Dump the metrics into a list of MetricData.
|
||||
*/
|
||||
class DumpMetricsData {
|
||||
final class DumpMetricsData {
|
||||
|
||||
private final Database database;
|
||||
|
||||
private final List<MetricData> list = new ArrayList<>();
|
||||
|
||||
DumpMetricsData(Database database) {
|
||||
@@ -30,7 +29,6 @@ class DumpMetricsData {
|
||||
}
|
||||
|
||||
private void collect(ServerMetrics serverMetrics) {
|
||||
|
||||
final List<MetaTimedMetric> timedMetrics = serverMetrics.timedMetrics();
|
||||
final List<MetaCountMetric> countMetrics = serverMetrics.countMetrics();
|
||||
final List<MetaQueryMetric> queryMetrics = serverMetrics.queryMetrics();
|
||||
|
||||
@@ -14,23 +14,18 @@ import java.io.StringWriter;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
class DumpMetricsJson implements ServerMetricsAsJson {
|
||||
final class DumpMetricsJson implements ServerMetricsAsJson {
|
||||
|
||||
private final Database database;
|
||||
|
||||
private Appendable writer;
|
||||
|
||||
/**
|
||||
* By default include sql and location attributes for the initial collection only.
|
||||
*/
|
||||
private int includeExtraAttributes = 1;
|
||||
|
||||
private boolean withHeader = true;
|
||||
private boolean withHash = true;
|
||||
private String newLine = "\n";
|
||||
|
||||
private Comparator<MetaTimedMetric> sortBy = SortMetric.NAME;
|
||||
|
||||
private int listCounter;
|
||||
private int objKeyCounter;
|
||||
|
||||
|
||||
@@ -12,10 +12,9 @@ import javax.sql.DataSource;
|
||||
/**
|
||||
* Initialise the main DataSource and read-only DataSource.
|
||||
*/
|
||||
class InitDataSource {
|
||||
final class InitDataSource {
|
||||
|
||||
private final JndiDataSourceLookup jndiDataSourceFactory = new JndiDataSourceLookup();
|
||||
|
||||
private final DatabaseConfig config;
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.Map;
|
||||
/**
|
||||
* Reads the Xml deployment information.
|
||||
*/
|
||||
class InternalConfigXmlMap {
|
||||
final class InternalConfigXmlMap {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(InternalConfigXmlMap.class);
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ import java.util.ServiceLoader;
|
||||
* Used to extend the DatabaseConfig with additional objects used to configure and
|
||||
* construct an Database.
|
||||
*/
|
||||
public class InternalConfiguration {
|
||||
public final class InternalConfiguration {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(InternalConfiguration.class);
|
||||
|
||||
|
||||
@@ -9,10 +9,7 @@ import javax.sql.DataSource;
|
||||
/**
|
||||
* Helper to lookup a DataSource from JNDI.
|
||||
*/
|
||||
public class JndiDataSourceLookup {
|
||||
|
||||
public JndiDataSourceLookup() {
|
||||
}
|
||||
class JndiDataSourceLookup {
|
||||
|
||||
/**
|
||||
* Return the DataSource by JNDI lookup.
|
||||
@@ -21,7 +18,6 @@ public class JndiDataSourceLookup {
|
||||
* </p>
|
||||
*/
|
||||
public DataSource lookup(String jndiName) {
|
||||
|
||||
try {
|
||||
Context ctx = new InitialContext();
|
||||
DataSource ds = (DataSource) ctx.lookup(jndiName);
|
||||
|
||||
+1
-2
@@ -15,11 +15,10 @@ import java.util.logging.Logger;
|
||||
/**
|
||||
* DataSource supplier that changes DB catalog based on current Tenant Id.
|
||||
*/
|
||||
public class MultiTenantDbCatalogSupplier implements DataSourceSupplier {
|
||||
final class MultiTenantDbCatalogSupplier implements DataSourceSupplier {
|
||||
|
||||
private final DataSource dataSource;
|
||||
private final DataSource readOnlyDataSource;
|
||||
|
||||
private final CatalogDataSource catalogDataSource;
|
||||
private final CatalogDataSource readOnly;
|
||||
|
||||
|
||||
+1
-2
@@ -15,11 +15,10 @@ import java.util.logging.Logger;
|
||||
/**
|
||||
* DataSource supplier that changes DB schema based on current Tenant Id.
|
||||
*/
|
||||
class MultiTenantDbSchemaSupplier implements DataSourceSupplier {
|
||||
final class MultiTenantDbSchemaSupplier implements DataSourceSupplier {
|
||||
|
||||
private final DataSource dataSource;
|
||||
private final DataSource readOnlyDataSource;
|
||||
|
||||
private final SchemaDataSource schemaDataSource;
|
||||
private final SchemaDataSource readOnly;
|
||||
|
||||
|
||||
@@ -11,10 +11,9 @@ import java.sql.SQLException;
|
||||
/**
|
||||
* DataSource supplier based on DataSource per Tenant.
|
||||
*/
|
||||
class MultiTenantDbSupplier implements DataSourceSupplier {
|
||||
final class MultiTenantDbSupplier implements DataSourceSupplier {
|
||||
|
||||
private final CurrentTenantProvider tenantProvider;
|
||||
|
||||
private final TenantDataSourceProvider dataSourceProvider;
|
||||
|
||||
MultiTenantDbSupplier(CurrentTenantProvider tenantProvider, TenantDataSourceProvider dataSourceProvider) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import io.ebean.bean.CallStack;
|
||||
/**
|
||||
* A CallOriginFactory we can use when we don't use AutoTune.
|
||||
*/
|
||||
class NoopCallOriginFactory implements CallOriginFactory {
|
||||
final class NoopCallOriginFactory implements CallOriginFactory {
|
||||
|
||||
private static final StackTraceElement E0 = new StackTraceElement("none", "none", "none", 0);
|
||||
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import io.ebeaninternal.server.deploy.id.ImportedId;
|
||||
* Deferred update of a relationship where an Id value is not initially available
|
||||
* so instead we execute this later as a SqlUpdate statement.
|
||||
*/
|
||||
public class PersistDeferredRelationship {
|
||||
public final class PersistDeferredRelationship {
|
||||
|
||||
private final SpiEbeanServer ebeanServer;
|
||||
private final BeanDescriptor<?> beanDescriptor;
|
||||
|
||||
@@ -1,215 +0,0 @@
|
||||
package io.ebeaninternal.server.core;
|
||||
|
||||
|
||||
/**
|
||||
* Helper for performing a 'refresh' on an Entity bean.
|
||||
* <p>
|
||||
* Note that this does not 'refresh' any OnetoMany or ManyToMany properties. It
|
||||
* refreshes all the other properties though.
|
||||
* </p>
|
||||
*/
|
||||
public class RefreshHelp {
|
||||
//
|
||||
// /**
|
||||
// * Helper for debug of lazy loading.
|
||||
// */
|
||||
// private final DebugLazyLoad debugLazyLoad;
|
||||
//
|
||||
// private final MAdminLoggingMBean logControl;
|
||||
//
|
||||
// public RefreshHelp(MAdminLoggingMBean logControl, boolean debugLazyLoad){
|
||||
// this.logControl = logControl;
|
||||
// this.debugLazyLoad = new DebugLazyLoad(debugLazyLoad);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Refresh the bean from property values in dbBean.
|
||||
// */
|
||||
// public void refresh(Object o, Object dbBean, BeanDescriptor<?> desc, EntityBeanIntercept ebi, Object id, boolean isLazyLoad) {
|
||||
//
|
||||
// Object originalOldValues = null;
|
||||
// boolean setOriginalOldValues = false;
|
||||
//
|
||||
// // set of properties to exclude from the refresh because it is
|
||||
// // not a refresh but rather a lazyLoading event.
|
||||
// Set<String> excludes = null;
|
||||
//
|
||||
// // turn off intercepting so lazy loading is
|
||||
// // not invoked when populating the bean
|
||||
// // with PropertyChangeSupport
|
||||
// ebi.setIntercepting(false);
|
||||
//
|
||||
// boolean readOnly = ebi.isReadOnly();
|
||||
// boolean sharedInstance = ebi.isSharedInstance();
|
||||
//
|
||||
// if (isLazyLoad){
|
||||
// excludes = ebi.getLoadedProps();
|
||||
// if (excludes != null){
|
||||
// // lazy loading a "Partial Object"... which already
|
||||
// // contains some properties and perhaps some oldValues
|
||||
// // and these will need to be maintained...
|
||||
// originalOldValues = ebi.getOldValues();
|
||||
// setOriginalOldValues = originalOldValues != null;
|
||||
// }
|
||||
//
|
||||
// if (logControl.isDebugLazyLoad()){
|
||||
// debug(desc, ebi, id, excludes);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// BeanProperty[] props = desc.propertiesBaseScalar();
|
||||
// for (int i = 0; i < props.length; i++) {
|
||||
// BeanProperty prop = props[i];
|
||||
// if (excludes != null && excludes.contains(prop.getName())){
|
||||
// // ignore this property (partial bean lazy loading)
|
||||
//
|
||||
// } else {
|
||||
// Object dbVal = prop.getValue(dbBean);
|
||||
// if (isLazyLoad) {
|
||||
// prop.setValue(o, dbVal);
|
||||
// } else {
|
||||
// prop.setValueIntercept(o, dbVal);
|
||||
// }
|
||||
// if (setOriginalOldValues){
|
||||
// // maintain original oldValues for partially loaded bean
|
||||
// prop.setValue(originalOldValues, dbVal);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// BeanPropertyAssocOne<?>[] ones = desc.propertiesOne();
|
||||
// for (int i = 0; i < ones.length; i++) {
|
||||
// BeanProperty prop = ones[i];
|
||||
// if (excludes != null && excludes.contains(prop.getName())){
|
||||
// // ignore this property (partial bean lazy loading)
|
||||
//
|
||||
// } else {
|
||||
// Object dbVal = prop.getValue(dbBean);
|
||||
// if (isLazyLoad){
|
||||
// prop.setValue(o, dbVal);
|
||||
// } else {
|
||||
// prop.setValueIntercept(o, dbVal);
|
||||
// }
|
||||
// if (setOriginalOldValues){
|
||||
// // maintain original oldValues for partially loaded bean
|
||||
// prop.setValue(originalOldValues, dbVal);
|
||||
// }
|
||||
// if (dbVal != null){
|
||||
// if (sharedInstance){
|
||||
// // propagate sharedInstance status to associated beans
|
||||
// ((EntityBean)dbVal)._ebean_getIntercept().setSharedInstance();
|
||||
// } else if (readOnly) {
|
||||
// // propagate readOnly status to associated beans
|
||||
// ((EntityBean)dbVal)._ebean_getIntercept().setReadOnly(true);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// refreshEmbedded(o, dbBean, desc, excludes, readOnly);
|
||||
//
|
||||
// // set a lazy loading many proxy if required
|
||||
// BeanPropertyAssocMany<?>[] manys = desc.propertiesMany();
|
||||
// for (int i = 0; i < manys.length; i++) {
|
||||
// BeanPropertyAssocMany<?> prop = manys[i];
|
||||
// if (excludes != null && excludes.contains(prop.getName())){
|
||||
// // the many already existed on the bean
|
||||
//
|
||||
// } else {
|
||||
// // set a lazy loading proxy
|
||||
// prop.createReference(o, null, readOnly, sharedInstance);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // the refreshed/lazy loaded bean is always fully
|
||||
// // populated so set loadedProps to null
|
||||
// ebi.setLoadedProps(null);
|
||||
//
|
||||
//
|
||||
// // reset the loaded status
|
||||
// ebi.setLoaded();
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Refresh the Embedded beans.
|
||||
// */
|
||||
// private void refreshEmbedded(Object o, Object dbBean, BeanDescriptor<?> desc, Set<String> excludes, boolean propagateReadOnly) {
|
||||
//
|
||||
// BeanPropertyAssocOne<?>[] embeds = desc.propertiesEmbedded();
|
||||
// for (int i = 0; i < embeds.length; i++) {
|
||||
// BeanPropertyAssocOne<?> prop = embeds[i];
|
||||
// if (excludes != null && excludes.contains(prop.getName())){
|
||||
// // ignore this property
|
||||
// } else {
|
||||
// // the original embedded bean
|
||||
// Object oEmb = prop.getValue(o);
|
||||
//
|
||||
// // the new one from the database
|
||||
// Object dbEmb = prop.getValue(dbBean);
|
||||
//
|
||||
// if (oEmb == null){
|
||||
// // original embedded bean was null
|
||||
// // so just replace the entire embedded bean
|
||||
// prop.setValueIntercept(o, dbEmb);
|
||||
// if (propagateReadOnly && dbEmb != null){
|
||||
// // propagate readOnly status to embedded beans
|
||||
// ((EntityBean)dbEmb)._ebean_getIntercept().setReadOnly(true);
|
||||
// }
|
||||
//
|
||||
// } else {
|
||||
// // refresh each property of the original
|
||||
// // embedded bean
|
||||
// if (oEmb instanceof EntityBean){
|
||||
// // turn off interception to stop invoking lazy loading
|
||||
// // but allow PropertyChangeSupport
|
||||
// ((EntityBean) oEmb)._ebean_getIntercept().setIntercepting(false);
|
||||
// }
|
||||
//
|
||||
// BeanProperty[] props = prop.getProperties();
|
||||
// for (int j = 0; j < props.length; j++) {
|
||||
// Object v = props[j].getValue(dbEmb);
|
||||
// props[j].setValueIntercept(oEmb, v);
|
||||
// }
|
||||
//
|
||||
// // No longer calling setLoaded() on embedded bean
|
||||
// // as the EntityBean itself
|
||||
// // .. calls setEmbeddedLoaded() on each of
|
||||
// // .. its embedded beans itself.
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * Output some debug to describe the lazy loading event.
|
||||
// */
|
||||
// private void debug(BeanDescriptor<?> desc, EntityBeanIntercept ebi, Object id, Set<String> excludes) {
|
||||
//
|
||||
//
|
||||
// Class<?> beanType = desc.getBeanType();
|
||||
//
|
||||
// StackTraceElement cause = debugLazyLoad.getStackTraceElement(beanType);
|
||||
//
|
||||
// String lazyLoadProperty = ebi.getLazyLoadProperty();
|
||||
// String msg = "debug.lazyLoad ["+desc+"] id["+id+"] lazyLoadProperty["+lazyLoadProperty+"]";
|
||||
// if (excludes != null){
|
||||
// msg += " partialProps"+excludes;
|
||||
// }
|
||||
// if (cause != null){
|
||||
// String causeLine = cause.toString();
|
||||
// if (causeLine.indexOf(".groovy:") > -1){
|
||||
// // eclipse console does not like finding groovy source at the moment
|
||||
// causeLine = StringHelper.replaceString(causeLine, ".groovy:", ".groovy :");
|
||||
// }
|
||||
// msg += " at: "+causeLine;
|
||||
// }
|
||||
// System.err.println(msg);
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
}
|
||||
@@ -10,10 +10,9 @@ import java.sql.SQLException;
|
||||
/**
|
||||
* Simple DataSource supplier when no multi-tenancy used.
|
||||
*/
|
||||
class SimpleDataSourceProvider implements DataSourceSupplier {
|
||||
final class SimpleDataSourceProvider implements DataSourceSupplier {
|
||||
|
||||
private final DataSource dataSource;
|
||||
|
||||
private final DataSource readOnlyDataSource;
|
||||
|
||||
SimpleDataSourceProvider(DataSource dataSource, DataSource readOnlyDataSource) {
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.sql.ResultSet;
|
||||
*
|
||||
* These both must be closed properly when done.
|
||||
*/
|
||||
public class SpiResultSet {
|
||||
public final class SpiResultSet {
|
||||
|
||||
private final PreparedStatement statement;
|
||||
|
||||
|
||||
@@ -14,9 +14,7 @@ import java.sql.SQLException;
|
||||
abstract class AssocOneHelp {
|
||||
|
||||
final BeanPropertyAssocOne<?> property;
|
||||
|
||||
private final BeanDescriptor<?> target;
|
||||
|
||||
private final String path;
|
||||
|
||||
AssocOneHelp(BeanPropertyAssocOne<?> property) {
|
||||
@@ -58,19 +56,16 @@ abstract class AssocOneHelp {
|
||||
* Read and return the bean.
|
||||
*/
|
||||
Object read(DbReadContext ctx) throws SQLException {
|
||||
|
||||
// Support for Inheritance hierarchy on exported OneToOne ?
|
||||
Object id = property.targetIdBinder.read(ctx);
|
||||
if (id == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
PersistenceContext pc = ctx.getPersistenceContext();
|
||||
Object existing = target.contextGet(pc, id);
|
||||
if (existing != null) {
|
||||
return existing;
|
||||
}
|
||||
|
||||
boolean disableLazyLoading = ctx.isDisableLazyLoading();
|
||||
Object ref = target.contextRef(pc, ctx.isReadOnly(), disableLazyLoading, id);
|
||||
if (!disableLazyLoading) {
|
||||
@@ -79,7 +74,6 @@ abstract class AssocOneHelp {
|
||||
return ref;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Read setting values into the bean.
|
||||
*/
|
||||
|
||||
@@ -32,7 +32,6 @@ final class AssocOneHelpEmbedded extends AssocOneHelp {
|
||||
|
||||
@Override
|
||||
Object read(DataReader reader) throws SQLException {
|
||||
|
||||
EntityBean embeddedBean = property.targetDescriptor.createEntityBean();
|
||||
boolean notNull = false;
|
||||
for (BeanProperty property : property.embeddedProps) {
|
||||
@@ -63,9 +62,7 @@ final class AssocOneHelpEmbedded extends AssocOneHelp {
|
||||
|
||||
@Override
|
||||
Object read(DbReadContext ctx) throws SQLException {
|
||||
|
||||
EntityBean embeddedBean = property.targetDescriptor.createEntityBean();
|
||||
|
||||
boolean notNull = false;
|
||||
for (BeanProperty property : property.embeddedProps) {
|
||||
Object value = property.readSet(ctx, embeddedBean);
|
||||
|
||||
+1
-4
@@ -5,10 +5,9 @@ import io.ebeaninternal.server.query.SqlJoinType;
|
||||
/**
|
||||
* Helper for BeanPropertyAssocOne for OneToOne exported reference - not so common.
|
||||
*/
|
||||
class AssocOneHelpRefExported extends AssocOneHelp {
|
||||
final class AssocOneHelpRefExported extends AssocOneHelp {
|
||||
|
||||
private final boolean softDelete;
|
||||
|
||||
private final String softDeletePredicate;
|
||||
|
||||
AssocOneHelpRefExported(BeanPropertyAssocOne<?> property) {
|
||||
@@ -22,7 +21,6 @@ class AssocOneHelpRefExported extends AssocOneHelp {
|
||||
*/
|
||||
@Override
|
||||
void appendSelect(DbSqlContext ctx, boolean subQuery) {
|
||||
|
||||
// set appropriate tableAlias for the exported id columns
|
||||
String relativePrefix = ctx.getRelativePrefix(property.getName());
|
||||
ctx.pushTableAlias(relativePrefix);
|
||||
@@ -32,7 +30,6 @@ class AssocOneHelpRefExported extends AssocOneHelp {
|
||||
|
||||
@Override
|
||||
void appendFrom(DbSqlContext ctx, SqlJoinType joinType) {
|
||||
|
||||
String relativePrefix = ctx.getRelativePrefix(property.getName());
|
||||
if (softDelete && !ctx.isIncludeSoftDelete()) {
|
||||
property.tableJoin.addJoin(joinType, relativePrefix, ctx, softDeletePredicate);
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.sql.SQLException;
|
||||
/**
|
||||
* Helper for BeanPropertyAssocOne imported reference but with inheritance.
|
||||
*/
|
||||
class AssocOneHelpRefInherit extends AssocOneHelp {
|
||||
final class AssocOneHelpRefInherit extends AssocOneHelp {
|
||||
|
||||
private final InheritInfo inherit;
|
||||
|
||||
@@ -29,7 +29,6 @@ class AssocOneHelpRefInherit extends AssocOneHelp {
|
||||
*/
|
||||
@Override
|
||||
Object read(DbReadContext ctx) throws SQLException {
|
||||
|
||||
// read discriminator to determine the type
|
||||
InheritInfo rowInheritInfo = inherit.readType(ctx);
|
||||
if (rowInheritInfo == null) {
|
||||
@@ -37,12 +36,10 @@ class AssocOneHelpRefInherit extends AssocOneHelp {
|
||||
property.targetIdBinder.loadIgnore(ctx);
|
||||
return null;
|
||||
}
|
||||
|
||||
Object id = property.targetIdBinder.read(ctx);
|
||||
if (id == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// check transaction context to see if it already exists
|
||||
PersistenceContext pc = ctx.getPersistenceContext();
|
||||
BeanDescriptor<?> desc = rowInheritInfo.desc();
|
||||
@@ -50,7 +47,6 @@ class AssocOneHelpRefInherit extends AssocOneHelp {
|
||||
if (existing != null) {
|
||||
return existing;
|
||||
}
|
||||
|
||||
// for inheritance hierarchy create the correct type for this row...
|
||||
boolean disableLazyLoading = ctx.isDisableLazyLoading();
|
||||
Object ref = desc.contextRef(pc, ctx.isReadOnly(), disableLazyLoading, id);
|
||||
@@ -72,7 +68,6 @@ class AssocOneHelpRefInherit extends AssocOneHelp {
|
||||
*/
|
||||
@Override
|
||||
void appendSelect(DbSqlContext ctx, boolean subQuery) {
|
||||
|
||||
if (!subQuery) {
|
||||
// add discriminator column
|
||||
String relativePrefix = ctx.getRelativePrefix(property.getName());
|
||||
|
||||
@@ -3,7 +3,7 @@ package io.ebeaninternal.server.deploy;
|
||||
/**
|
||||
* Helper for BeanPropertyAssocOne imported reference - this is the common case.
|
||||
*/
|
||||
class AssocOneHelpRefSimple extends AssocOneHelp {
|
||||
final class AssocOneHelpRefSimple extends AssocOneHelp {
|
||||
|
||||
AssocOneHelpRefSimple(BeanPropertyAssocOne<?> property, String embeddedPrefix) {
|
||||
super(property, embeddedPrefix);
|
||||
|
||||
@@ -13,7 +13,6 @@ abstract class BaseCollectionHelp<T> implements BeanCollectionHelp<T> {
|
||||
final BeanPropertyAssocMany<T> many;
|
||||
private final BeanDescriptor<T> targetDescriptor;
|
||||
final String propertyName;
|
||||
|
||||
BeanCollectionLoader loader;
|
||||
|
||||
BaseCollectionHelp(BeanPropertyAssocMany<T> many) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user