mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Compare commits
60
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c89d39ec2d | ||
|
|
556557276c | ||
|
|
0273e1c2c8 | ||
|
|
8440a13b0f | ||
|
|
c5e940733c | ||
|
|
ac73031bec | ||
|
|
a65ff8a650 | ||
|
|
f904fea104 | ||
|
|
2549eace09 | ||
|
|
a592717c77 | ||
|
|
db6f93e383 | ||
|
|
0a0d67585c | ||
|
|
db2f8cd811 | ||
|
|
b6e524f879 | ||
|
|
40492f487c | ||
|
|
2cee03bc4b | ||
|
|
e2c6125501 | ||
|
|
b53221fc0e | ||
|
|
b23551ce43 | ||
|
|
3971ccea1a | ||
|
|
35b1f835c5 | ||
|
|
ef5e3a796d | ||
|
|
d3dbde4e79 | ||
|
|
033c579984 | ||
|
|
1a34a56351 | ||
|
|
edfdbd56b1 | ||
|
|
8f94072afd | ||
|
|
d028b200fa | ||
|
|
9af006b15b | ||
|
|
35a6ff7f02 | ||
|
|
cebac8040f | ||
|
|
e8524c5b1a | ||
|
|
3244314424 | ||
|
|
0a4c26965c | ||
|
|
6238243c91 | ||
|
|
c1d7e77d85 | ||
|
|
5b07309f51 | ||
|
|
8ee67410f9 | ||
|
|
dec114028f | ||
|
|
477e7eeeda | ||
|
|
c9c61d9f97 | ||
|
|
d0909ad140 | ||
|
|
13c94ac78d | ||
|
|
f467ca2e10 | ||
|
|
d5c24d327e | ||
|
|
23cd45b5d1 | ||
|
|
a14f7a1766 | ||
|
|
c86a8c2d32 | ||
|
|
e85a471fcf | ||
|
|
57689db291 | ||
|
|
fec87b5281 | ||
|
|
21bd83b417 | ||
|
|
fde5350c43 | ||
|
|
769f6b72ae | ||
|
|
97e9b3c473 | ||
|
|
3550bf61c4 | ||
|
|
0bf8c9eb64 | ||
|
|
01e7ddcffd | ||
|
|
b450227b13 | ||
|
|
a1b4b1d8ca |
+1
-1
@@ -34,7 +34,7 @@ env:
|
||||
install: true
|
||||
|
||||
script:
|
||||
- mvn clean test
|
||||
- mvn -T 1C clean test
|
||||
|
||||
after_failure:
|
||||
- ./.travis/print_surefire_reports
|
||||
|
||||
@@ -36,7 +36,7 @@ Post questions or issues to the Ebean google group - https://groups.google.com/f
|
||||
Goto [https://ebean.io/docs/](https://ebean.io/docs/)
|
||||
|
||||
|
||||
## Maven cental links:
|
||||
## Maven central links:
|
||||
[Maven central - ebean](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22io.ebean%22%20AND%20a%3A%22ebean%22 "maven central ebean")
|
||||
|
||||
[Maven central - all related projects](http://search.maven.org/#search%7Cga%7C1%7Cebean "maven central all related projects")
|
||||
|
||||
+9
-9
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.11.5</version>
|
||||
<version>12.12.2</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean api</name>
|
||||
@@ -27,7 +27,7 @@
|
||||
<dependency>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>avaje-config</artifactId>
|
||||
<version>1.4</version>
|
||||
<version>1.5</version>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
@@ -116,16 +116,16 @@
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.5</version>
|
||||
<groupId>io.repaint.maven</groupId>
|
||||
<artifactId>tiles-maven-plugin</artifactId>
|
||||
<version>2.24</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
|
||||
</archive>
|
||||
<tiles>
|
||||
<tile>io.avaje.tile:moditech-module:1.0</tile>
|
||||
</tiles>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean api</name>
|
||||
<description>ebean api</description>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!--
|
||||
Projects are expected to explicit depend on version
|
||||
of slf4j that they want to use
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.30</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>avaje-config</artifactId>
|
||||
<version>1.5</version>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
Class retention Nonnull and Nullable annotations
|
||||
to assist with IDE auto-completion with Ebean API
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>avaje-jsr305</artifactId>
|
||||
<version>1.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>persistence-api</artifactId>
|
||||
<version>2.2.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-annotation</artifactId>
|
||||
<version>7.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-types</artifactId>
|
||||
<version>2.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-datasource-api</artifactId>
|
||||
<version>${ebean-datasource.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Jackson core used internally by Ebean -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- provided scope for JsonNode support -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- Provided scope so that the H2HistoryTrigger can live in Ebean core
|
||||
and not require a separate module for it -->
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<version>1.4.199</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.transaction</groupId>
|
||||
<artifactId>jta</artifactId>
|
||||
<version>1.1</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>io.repaint.maven</groupId>
|
||||
<artifactId>tiles-maven-plugin</artifactId>
|
||||
<version>2.24</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<tiles>
|
||||
<tile>io.avaje.tile:moditech-module:1.0</tile>
|
||||
</tiles>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -15,8 +15,7 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
*/
|
||||
final class DbContext {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(DbContext.class);
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger("io.ebean");
|
||||
static {
|
||||
EbeanVersion.getVersion();
|
||||
}
|
||||
@@ -39,7 +38,6 @@ final class DbContext {
|
||||
if (!DbPrimary.isSkip()) {
|
||||
// look to see if there is a default server defined
|
||||
String defaultName = DbPrimary.getDefaultServerName();
|
||||
logger.debug("defaultName:{}", defaultName);
|
||||
if (defaultName != null && !defaultName.trim().isEmpty()) {
|
||||
defaultDatabase = getWithCreate(defaultName.trim());
|
||||
}
|
||||
@@ -54,7 +52,7 @@ final class DbContext {
|
||||
throw new DataSourceConfigurationException(msg, e);
|
||||
|
||||
} catch (Throwable e) {
|
||||
logger.error("Error trying to create the default Database", e);
|
||||
log.error("Error trying to create the default Database", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,26 +14,75 @@ import java.util.Properties;
|
||||
*/
|
||||
public class EbeanVersion {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(EbeanVersion.class);
|
||||
private static final Logger log = LoggerFactory.getLogger("io.ebean");
|
||||
|
||||
/**
|
||||
* Maintain the minimum ebean-agent version manually based on required ebean-agent bug fixes.
|
||||
*/
|
||||
private static final int MIN_AGENT_MAJOR_VERSION = 12;
|
||||
private static final int MIN_AGENT_MINOR_VERSION = 12;
|
||||
private static String version = "unknown";
|
||||
|
||||
static {
|
||||
readVersion();
|
||||
checkAgentVersion();
|
||||
}
|
||||
|
||||
private static void readVersion() {
|
||||
try {
|
||||
Properties prop = new Properties();
|
||||
try (InputStream in = DB.class.getResourceAsStream("/META-INF/maven/io.ebean/ebean/pom.properties")) {
|
||||
try (InputStream in = ClassLoader.getSystemResourceAsStream("META-INF/maven/io.ebean/ebean-api/pom.properties")) {
|
||||
if (in != null) {
|
||||
prop.load(in);
|
||||
in.close();
|
||||
version = prop.getProperty("version");
|
||||
version = readVersion(in);
|
||||
}
|
||||
}
|
||||
logger.info("ebean version: {}", version);
|
||||
log.info("ebean version: {}", version);
|
||||
} catch (IOException e) {
|
||||
logger.warn("Could not determine ebean version: {}", e.getMessage());
|
||||
log.warn("Could not determine ebean version: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private static void checkAgentVersion() {
|
||||
try {
|
||||
try (InputStream in = ClassLoader.getSystemResourceAsStream("META-INF/maven/io.ebean/ebean-agent/pom.properties")) {
|
||||
// often we only have ebean-agent during development (with build time enhancement), null is expected
|
||||
if (in != null) {
|
||||
String agentVersion = readVersion(in);
|
||||
if (agentVersion != null) {
|
||||
if (checkMinAgentVersion(agentVersion)) {
|
||||
log.error("Expected minimum ebean-agent version {}.{}.0 but we have {}, please update the ebean-agent", MIN_AGENT_MAJOR_VERSION, MIN_AGENT_MINOR_VERSION, agentVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.warn("Could not check minimum ebean-agent version {}.{}.0 required due to - {}", MIN_AGENT_MAJOR_VERSION, MIN_AGENT_MINOR_VERSION, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if ebean-agent is NOT at our minimum version.
|
||||
*/
|
||||
static boolean checkMinAgentVersion(String agentVersion) {
|
||||
String[] versionSegments = agentVersion.split("\\.");
|
||||
if (versionSegments.length != 3) {
|
||||
return true;
|
||||
} else {
|
||||
int major = Integer.parseInt(versionSegments[0]);
|
||||
int minor = Integer.parseInt(versionSegments[1]);
|
||||
if (major < MIN_AGENT_MAJOR_VERSION) {
|
||||
return true;
|
||||
} else {
|
||||
return major == MIN_AGENT_MAJOR_VERSION && minor < MIN_AGENT_MINOR_VERSION;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static String readVersion(InputStream in) throws IOException {
|
||||
Properties prop = new Properties();
|
||||
prop.load(in);
|
||||
in.close();
|
||||
return prop.getProperty("version");
|
||||
}
|
||||
|
||||
private EbeanVersion() {
|
||||
// hide
|
||||
}
|
||||
|
||||
@@ -111,28 +111,28 @@ public final class Pairs {
|
||||
/**
|
||||
* Return the first property name.
|
||||
*/
|
||||
public String getProperty0() {
|
||||
public String property0() {
|
||||
return property0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the second property name.
|
||||
*/
|
||||
public String getProperty1() {
|
||||
public String property1() {
|
||||
return property1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all the value pairs.
|
||||
*/
|
||||
public List<Entry> getEntries() {
|
||||
public List<Entry> entries() {
|
||||
return Collections.unmodifiableList(entries);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the separator character used with DB varchar concatenation to combine the 2 values.
|
||||
*/
|
||||
public String getConcatSeparator() {
|
||||
public String concatSeparator() {
|
||||
return concatSeparator;
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ public final class Pairs {
|
||||
/**
|
||||
* Return a suffix used with DB varchar concatenation to combine the 2 values.
|
||||
*/
|
||||
public String getConcatSuffix() {
|
||||
public String concatSuffix() {
|
||||
return concatSuffix;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
package io.ebean.config;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.Enumeration;
|
||||
|
||||
/**
|
||||
* Helper to find classes taking into account the context class loader.
|
||||
*/
|
||||
@@ -77,22 +72,14 @@ public class ClassLoadConfig {
|
||||
* Return a new instance of the class using the default constructor.
|
||||
*/
|
||||
public Object newInstance(String className) {
|
||||
|
||||
try {
|
||||
Class<?> cls = forName(className);
|
||||
return cls.newInstance();
|
||||
return cls.getDeclaredConstructor().newInstance();
|
||||
} catch (Exception e) {
|
||||
throw new IllegalArgumentException("Error constructing " + className, e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the resources for the given name.
|
||||
*/
|
||||
public Enumeration<URL> getResources(String name) throws IOException {
|
||||
return context.getResources(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the given class is present.
|
||||
*/
|
||||
@@ -129,9 +116,7 @@ public class ClassLoadConfig {
|
||||
* Optional - if set only use this classLoader (no fallback).
|
||||
*/
|
||||
protected final ClassLoader preferredLoader;
|
||||
|
||||
protected final ClassLoader contextLoader;
|
||||
|
||||
protected final ClassLoader callerLoader;
|
||||
|
||||
ClassLoaderContext(ClassLoader preferredLoader) {
|
||||
@@ -145,15 +130,7 @@ public class ClassLoadConfig {
|
||||
return (loader != null) ? loader : callerLoader;
|
||||
}
|
||||
|
||||
Enumeration<URL> getResources(String name) throws IOException {
|
||||
if (preferredLoader != null) {
|
||||
return preferredLoader.getResources(name);
|
||||
}
|
||||
return contextLoader().getResources(name);
|
||||
}
|
||||
|
||||
Class<?> forName(String name) throws ClassNotFoundException {
|
||||
|
||||
if (preferredLoader != null) {
|
||||
// only use the explicitly set classLoader
|
||||
return classForName(name, preferredLoader);
|
||||
|
||||
@@ -2,11 +2,7 @@ package io.ebean.config;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonFactory;
|
||||
import io.avaje.config.Config;
|
||||
import io.ebean.DatabaseFactory;
|
||||
import io.ebean.EbeanVersion;
|
||||
import io.ebean.PersistenceContextScope;
|
||||
import io.ebean.Query;
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.*;
|
||||
import io.ebean.annotation.*;
|
||||
import io.ebean.cache.ServerCachePlugin;
|
||||
import io.ebean.config.dbplatform.DatabasePlatform;
|
||||
@@ -14,14 +10,7 @@ import io.ebean.config.dbplatform.DbEncrypt;
|
||||
import io.ebean.config.dbplatform.DbType;
|
||||
import io.ebean.config.dbplatform.IdType;
|
||||
import io.ebean.datasource.DataSourceConfig;
|
||||
import io.ebean.event.BeanFindController;
|
||||
import io.ebean.event.BeanPersistController;
|
||||
import io.ebean.event.BeanPersistListener;
|
||||
import io.ebean.event.BeanPostConstructListener;
|
||||
import io.ebean.event.BeanPostLoad;
|
||||
import io.ebean.event.BeanQueryAdapter;
|
||||
import io.ebean.event.BulkTableEventListener;
|
||||
import io.ebean.event.ServerConfigStartup;
|
||||
import io.ebean.event.*;
|
||||
import io.ebean.event.changelog.ChangeLogListener;
|
||||
import io.ebean.event.changelog.ChangeLogPrepare;
|
||||
import io.ebean.event.changelog.ChangeLogRegister;
|
||||
@@ -34,14 +23,7 @@ import javax.sql.DataSource;
|
||||
import java.time.Clock;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* The configuration used for creating a Database.
|
||||
@@ -82,7 +64,6 @@ import java.util.ServiceLoader;
|
||||
*/
|
||||
public class DatabaseConfig {
|
||||
|
||||
|
||||
/**
|
||||
* The Database name.
|
||||
*/
|
||||
@@ -402,8 +383,8 @@ public class DatabaseConfig {
|
||||
private List<BeanPostConstructListener> postConstructListeners = new ArrayList<>();
|
||||
private List<BeanPersistListener> persistListeners = new ArrayList<>();
|
||||
private List<BeanQueryAdapter> queryAdapters = new ArrayList<>();
|
||||
private List<BulkTableEventListener> bulkTableEventListeners = new ArrayList<>();
|
||||
private List<ServerConfigStartup> configStartupListeners = new ArrayList<>();
|
||||
private final List<BulkTableEventListener> bulkTableEventListeners = new ArrayList<>();
|
||||
private final List<ServerConfigStartup> configStartupListeners = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* By default inserts are included in the change log.
|
||||
@@ -411,42 +392,26 @@ public class DatabaseConfig {
|
||||
private boolean changeLogIncludeInserts = true;
|
||||
|
||||
private ChangeLogPrepare changeLogPrepare;
|
||||
|
||||
private ChangeLogListener changeLogListener;
|
||||
|
||||
private ChangeLogRegister changeLogRegister;
|
||||
|
||||
private boolean changeLogAsync = true;
|
||||
|
||||
private ReadAuditLogger readAuditLogger;
|
||||
|
||||
private ReadAuditPrepare readAuditPrepare;
|
||||
|
||||
private EncryptKeyManager encryptKeyManager;
|
||||
|
||||
private EncryptDeployManager encryptDeployManager;
|
||||
|
||||
private Encryptor encryptor;
|
||||
|
||||
private boolean dbOffline;
|
||||
|
||||
private DbEncrypt dbEncrypt;
|
||||
|
||||
private boolean dbOffline;
|
||||
private ServerCachePlugin serverCachePlugin;
|
||||
|
||||
/**
|
||||
* The default PersistenceContextScope used if one is not explicitly set on a query.
|
||||
*/
|
||||
private PersistenceContextScope persistenceContextScope = PersistenceContextScope.TRANSACTION;
|
||||
|
||||
private JsonFactory jsonFactory;
|
||||
|
||||
private boolean localTimeWithNanos;
|
||||
|
||||
private boolean durationWithNanos;
|
||||
|
||||
private int maxCallStack = 5;
|
||||
|
||||
private boolean transactionRollbackOnChecked = true;
|
||||
|
||||
// configuration for the background executor service (thread pool)
|
||||
@@ -2741,21 +2706,7 @@ public class DatabaseConfig {
|
||||
this.classLoadConfig = classLoadConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the service loader using the classLoader defined in ClassLoadConfig.
|
||||
*/
|
||||
public <T> ServiceLoader<T> serviceLoad(Class<T> spiService) {
|
||||
return ServiceLoader.load(spiService, classLoadConfig.getClassLoader());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the first service using the service loader (or null).
|
||||
*/
|
||||
public <T> T service(Class<T> spiService) {
|
||||
ServiceLoader<T> load = serviceLoad(spiService);
|
||||
Iterator<T> serviceInstances = load.iterator();
|
||||
return serviceInstances.hasNext() ? serviceInstances.next() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load settings from application.properties, application.yaml and other sources.
|
||||
@@ -2794,7 +2745,7 @@ public class DatabaseConfig {
|
||||
*/
|
||||
private List<AutoConfigure> autoConfiguration() {
|
||||
List<AutoConfigure> list = new ArrayList<>();
|
||||
for (AutoConfigure autoConfigure : serviceLoad(AutoConfigure.class)) {
|
||||
for (AutoConfigure autoConfigure : ServiceLoader.load(AutoConfigure.class)) {
|
||||
autoConfigure.preConfigure(this);
|
||||
list.add(autoConfigure);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.sql.Types;
|
||||
*/
|
||||
public class DatabasePlatform {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(DatabasePlatform.class);
|
||||
private static final Logger log = LoggerFactory.getLogger("io.ebean");
|
||||
|
||||
/**
|
||||
* Behavior used when ending a query only transaction (at read committed isolation level).
|
||||
@@ -640,7 +640,7 @@ public class DatabasePlatform {
|
||||
if (dbName.charAt(dbName.length() - 1) == BACK_TICK) {
|
||||
return openQuote + dbName.substring(1, dbName.length() - 1) + closeQuote;
|
||||
} else {
|
||||
logger.error("Missing backquote on [" + dbName + "]");
|
||||
log.error("Missing backquote on [" + dbName + "]");
|
||||
}
|
||||
} else if (allQuotedIdentifiers) {
|
||||
return openQuote + dbName + closeQuote;
|
||||
@@ -694,7 +694,7 @@ public class DatabasePlatform {
|
||||
|
||||
protected String withForUpdate(String sql, Query.LockWait lockWait, Query.LockType lockType) {
|
||||
// silently assume the database does not support the "for update" clause.
|
||||
logger.info("it seems your database does not support the 'for update' clause");
|
||||
log.info("it seems your database does not support the 'for update' clause");
|
||||
return sql;
|
||||
}
|
||||
|
||||
@@ -728,7 +728,7 @@ public class DatabasePlatform {
|
||||
if (!schemaExists(dbSchema, connection)) {
|
||||
Statement query = connection.createStatement();
|
||||
try {
|
||||
logger.info("create schema:{}", dbSchema);
|
||||
log.debug("create schema:{}", dbSchema);
|
||||
query.executeUpdate("create schema " + dbSchema);
|
||||
} finally {
|
||||
JdbcClose.close(query);
|
||||
@@ -758,7 +758,6 @@ public class DatabasePlatform {
|
||||
* Return true if the table exists.
|
||||
*/
|
||||
public boolean tableExists(Connection connection, String catalog, String schema, String table) throws SQLException {
|
||||
|
||||
DatabaseMetaData metaData = connection.getMetaData();
|
||||
ResultSet tables = metaData.getTables(catalog, schema, table, null);
|
||||
try {
|
||||
|
||||
@@ -70,7 +70,6 @@ public class DbPlatformTypeMapping {
|
||||
* Load the standard types. These can be overridden by DB specific platform.
|
||||
*/
|
||||
private void loadDefaults(boolean logicalTypes) {
|
||||
|
||||
put(DbType.BOOLEAN, BOOLEAN_LOGICAL);
|
||||
put(DbType.BIT);
|
||||
put(DbType.INTEGER);
|
||||
@@ -88,7 +87,6 @@ public class DbPlatformTypeMapping {
|
||||
put(DbType.LONGVARCHAR);
|
||||
// most commonly real maps to db float
|
||||
put(DbType.REAL, new DbPlatformType("float"));
|
||||
|
||||
put(DbType.POINT, POINT);
|
||||
put(DbType.POLYGON, POLYGON);
|
||||
put(DbType.LINESTRING, LINESTRING);
|
||||
@@ -103,7 +101,7 @@ public class DbPlatformTypeMapping {
|
||||
put(DbType.VARBINARY, new DbPlatformType("varbinary"));
|
||||
put(DbType.BINARY, new DbPlatformType("binary"));
|
||||
put(DbType.CHAR, new DbPlatformType("char"));
|
||||
|
||||
put(DbType.LOCALDATETIME, new DbPlatformType("localdatetime", false));
|
||||
put(DbType.HSTORE, new DbPlatformType("hstore", false));
|
||||
put(DbType.JSON, new DbPlatformType("json", false));
|
||||
put(DbType.JSONB, new DbPlatformType("jsonb", false));
|
||||
@@ -120,7 +118,7 @@ public class DbPlatformTypeMapping {
|
||||
put(DbType.VARBINARY, new DbPlatformType("varbinary", 255));
|
||||
put(DbType.BINARY, new DbPlatformType("binary", 255));
|
||||
put(DbType.CHAR, new DbPlatformType("char", 1));
|
||||
|
||||
put(DbType.LOCALDATETIME, DbType.TIMESTAMP.createPlatformType());
|
||||
put(DbType.JSON, JSON_CLOB_PLACEHOLDER); // Postgres maps this to JSON
|
||||
put(DbType.JSONB, JSON_CLOB_PLACEHOLDER); // Postgres maps this to JSONB
|
||||
put(DbType.JSONCLOB, JSON_CLOB_PLACEHOLDER);
|
||||
@@ -137,7 +135,6 @@ public class DbPlatformTypeMapping {
|
||||
* Lookup the platform specific DbType given the standard sql type name.
|
||||
*/
|
||||
public DbPlatformType lookup(String name, boolean withScale) {
|
||||
|
||||
DbType type = lookup.byName(name);
|
||||
if (type == null) {
|
||||
throw new IllegalArgumentException("Unknown type [" + name + "] - not standard sql type");
|
||||
@@ -160,7 +157,6 @@ public class DbPlatformTypeMapping {
|
||||
}
|
||||
|
||||
private DbPlatformType getJsonType(DbType type, boolean withScale) {
|
||||
|
||||
DbPlatformType dbType = get(type);
|
||||
if (dbType == JSON_CLOB_PLACEHOLDER) {
|
||||
// if we have scale that implies this maps to varchar
|
||||
|
||||
@@ -34,6 +34,7 @@ public enum DbType {
|
||||
|
||||
ARRAY(Types.ARRAY),
|
||||
|
||||
LOCALDATETIME(ExtraDbTypes.LOCALDATETIME),
|
||||
UUID(ExtraDbTypes.UUID),
|
||||
INET(ExtraDbTypes.INET),
|
||||
CIDR(ExtraDbTypes.CIDR),
|
||||
|
||||
@@ -5,11 +5,6 @@ package io.ebean.config.dbplatform;
|
||||
*/
|
||||
public interface ExtraDbTypes {
|
||||
|
||||
/**
|
||||
* DB native UUID type (H2 and Postgres).
|
||||
*/
|
||||
int UUID = 5010;
|
||||
|
||||
/**
|
||||
* Type to map Map content to Postgres HSTORE.
|
||||
*/
|
||||
@@ -40,6 +35,12 @@ public interface ExtraDbTypes {
|
||||
*/
|
||||
int JSONBlob = 5005;
|
||||
|
||||
int LOCALDATETIME = 5009;
|
||||
|
||||
/**
|
||||
* DB native UUID type (H2 and Postgres).
|
||||
*/
|
||||
int UUID = 5010;
|
||||
int INET = 5020;
|
||||
int CIDR = 5021;
|
||||
|
||||
|
||||
@@ -24,23 +24,14 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
*/
|
||||
public abstract class SequenceIdGenerator implements PlatformIdGenerator {
|
||||
|
||||
protected static final Logger logger = LoggerFactory.getLogger("io.ebean.SEQ");
|
||||
protected static final Logger log = LoggerFactory.getLogger("io.ebean.SEQ");
|
||||
|
||||
private final ReentrantLock lock = new ReentrantLock();
|
||||
|
||||
/**
|
||||
* The actual sequence name.
|
||||
*/
|
||||
protected final String seqName;
|
||||
|
||||
protected final DataSource dataSource;
|
||||
|
||||
protected final BackgroundExecutor backgroundExecutor;
|
||||
|
||||
protected final NavigableSet<Long> idList = new TreeSet<>();
|
||||
|
||||
protected final int allocationSize;
|
||||
|
||||
protected AtomicBoolean currentlyBackgroundLoading = new AtomicBoolean(false);
|
||||
|
||||
/**
|
||||
@@ -129,7 +120,7 @@ public abstract class SequenceIdGenerator implements PlatformIdGenerator {
|
||||
protected void loadInBackground(final int requestSize) {
|
||||
if (currentlyBackgroundLoading.get()) {
|
||||
// skip as already background loading
|
||||
logger.debug("... skip background sequence load (another load in progress)");
|
||||
log.debug("... skip background sequence load (another load in progress)");
|
||||
return;
|
||||
}
|
||||
currentlyBackgroundLoading.set(true);
|
||||
@@ -161,8 +152,8 @@ public abstract class SequenceIdGenerator implements PlatformIdGenerator {
|
||||
resultSet = statement.executeQuery();
|
||||
|
||||
List<Long> newIds = readIds(resultSet, requestSize);
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("seq:{} loaded:{} sql:{}", seqName, newIds.size(), sql);
|
||||
if (log.isTraceEnabled()) {
|
||||
log.trace("seq:{} loaded:{} sql:{}", seqName, newIds.size(), sql);
|
||||
}
|
||||
if (newIds.isEmpty()) {
|
||||
throw new PersistenceException("Always expecting more than 1 row from " + sql);
|
||||
@@ -173,7 +164,7 @@ public abstract class SequenceIdGenerator implements PlatformIdGenerator {
|
||||
} catch (SQLException e) {
|
||||
if (e.getMessage().contains("Database is already closed")) {
|
||||
String msg = "Error getting SEQ when DB shutting down " + e.getMessage();
|
||||
logger.error(msg);
|
||||
log.error(msg);
|
||||
System.out.println(msg);
|
||||
return Collections.emptyList();
|
||||
} else {
|
||||
|
||||
@@ -2,8 +2,6 @@ package io.ebean.config.dbplatform;
|
||||
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.util.JdbcClose;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.sql.DataSource;
|
||||
@@ -20,12 +18,8 @@ import java.sql.SQLException;
|
||||
*/
|
||||
public class SimpleSequenceIdGenerator implements PlatformIdGenerator {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(SimpleSequenceIdGenerator.class);
|
||||
|
||||
private final String sql;
|
||||
|
||||
private final DataSource dataSource;
|
||||
|
||||
private final String seqName;
|
||||
|
||||
/**
|
||||
|
||||
+1
-4
@@ -26,7 +26,6 @@ public class ClickHousePlatform extends DatabasePlatform {
|
||||
|
||||
this.booleanDbType = Types.INTEGER;
|
||||
dbTypeMap.put(DbType.BOOLEAN, new DbPlatformType("UInt8"));
|
||||
|
||||
// using unsigned as default types ...
|
||||
dbTypeMap.put(DbType.TINYINT, new DbPlatformType("UInt8", false));
|
||||
dbTypeMap.put(DbType.SMALLINT, new DbPlatformType("UInt16", false));
|
||||
@@ -34,15 +33,13 @@ public class ClickHousePlatform extends DatabasePlatform {
|
||||
dbTypeMap.put(DbType.BIGINT, new DbPlatformType("UInt64", false));
|
||||
dbTypeMap.put(DbType.DECIMAL, new DbPlatformType("Decimal", 16, 3));
|
||||
dbTypeMap.put(DbType.DOUBLE, new DbPlatformType("Float64", false));
|
||||
|
||||
dbTypeMap.put(DbType.DATE, new DbPlatformType("Date", false));
|
||||
dbTypeMap.put(DbType.TIMESTAMP, new DbPlatformType("DateTime", false));
|
||||
|
||||
dbTypeMap.put(DbType.LOCALDATETIME, new DbPlatformType("DateTime", false));
|
||||
dbTypeMap.put(DbType.VARCHAR, new DbPlatformType("String", false));
|
||||
dbTypeMap.put(DbType.LONGVARCHAR, new DbPlatformType("String", false));
|
||||
dbTypeMap.put(DbType.CLOB, new DbPlatformType("String", false));
|
||||
dbTypeMap.put(DbType.JSONVARCHAR, new DbPlatformType("String", false));
|
||||
|
||||
dbTypeMap.put(DbType.UUID, new DbPlatformType("UUID", false));
|
||||
dbTypeMap.put(DbType.INET, new DbPlatformType("String", false));
|
||||
dbTypeMap.put(DbType.CIDR, new DbPlatformType("String", false));
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.Arrays;
|
||||
*/
|
||||
public class H2HistoryTrigger implements Trigger {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(H2HistoryTrigger.class);
|
||||
private static final Logger log = LoggerFactory.getLogger(H2HistoryTrigger.class);
|
||||
|
||||
/**
|
||||
* Hardcoding the column and history table suffix for now. Not sure how to get that
|
||||
@@ -69,7 +69,7 @@ public class H2HistoryTrigger implements Trigger {
|
||||
insertSql.append(");");
|
||||
|
||||
this.insertHistorySql = insertSql.toString();
|
||||
logger.debug("History table insert sql: {}", insertHistorySql);
|
||||
log.debug("History table insert sql: {}", insertHistorySql);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -82,8 +82,8 @@ public class H2HistoryTrigger implements Trigger {
|
||||
// update event. Set the effective start timestamp to now.
|
||||
newRow[effectStartPosition] = now;
|
||||
}
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("History insert: {}", Arrays.toString(oldRow));
|
||||
if (log.isTraceEnabled()) {
|
||||
log.trace("History insert: {}", Arrays.toString(oldRow));
|
||||
}
|
||||
insertIntoHistory(connection, oldRow);
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ public abstract class BaseMySqlPlatform extends DatabasePlatform {
|
||||
dbTypeMap.put(DbType.BIT, new DbPlatformType("tinyint(1)"));
|
||||
dbTypeMap.put(DbType.BOOLEAN, new DbPlatformType("tinyint(1)"));
|
||||
dbTypeMap.put(DbType.TIMESTAMP, new DbPlatformType("datetime(6)"));
|
||||
dbTypeMap.put(DbType.LOCALDATETIME, new DbPlatformType("datetime(6)"));
|
||||
dbTypeMap.put(DbType.CLOB, new MySqlClob());
|
||||
dbTypeMap.put(DbType.BLOB, new MySqlBlob());
|
||||
dbTypeMap.put(DbType.BINARY, new DbPlatformType("binary", 255));
|
||||
|
||||
@@ -10,5 +10,6 @@ public class MySql55Platform extends BaseMySqlPlatform {
|
||||
super();
|
||||
this.platform = Platform.MYSQL55;
|
||||
dbTypeMap.put(DbType.TIMESTAMP, new DbPlatformType("datetime"));
|
||||
dbTypeMap.put(DbType.LOCALDATETIME, new DbPlatformType("datetime"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,22 +69,19 @@ public class PostgresPlatform extends DatabasePlatform {
|
||||
|
||||
DbPlatformType dbTypeText = new DbPlatformType("text", false);
|
||||
DbPlatformType dbBytea = new DbPlatformType("bytea", false);
|
||||
|
||||
dbTypeMap.put(DbType.UUID, new DbPlatformType("uuid", false));
|
||||
dbTypeMap.put(DbType.INET, new DbPlatformType("inet", false));
|
||||
dbTypeMap.put(DbType.CIDR, new DbPlatformType("cidr", false));
|
||||
dbTypeMap.put(DbType.HSTORE, new DbPlatformType("hstore", false));
|
||||
dbTypeMap.put(DbType.JSON, new DbPlatformType("json", false));
|
||||
dbTypeMap.put(DbType.JSONB, new DbPlatformType("jsonb", false));
|
||||
|
||||
dbTypeMap.put(DbType.INTEGER, new DbPlatformType("integer", false));
|
||||
dbTypeMap.put(DbType.DOUBLE, new DbPlatformType("float"));
|
||||
dbTypeMap.put(DbType.TINYINT, new DbPlatformType("smallint"));
|
||||
dbTypeMap.put(DbType.TIMESTAMP, new DbPlatformType("timestamptz"));
|
||||
|
||||
dbTypeMap.put(DbType.LOCALDATETIME, new DbPlatformType("timestamp"));
|
||||
dbTypeMap.put(DbType.BINARY, dbBytea);
|
||||
dbTypeMap.put(DbType.VARBINARY, dbBytea);
|
||||
|
||||
dbTypeMap.put(DbType.BLOB, dbBytea);
|
||||
dbTypeMap.put(DbType.CLOB, dbTypeText);
|
||||
dbTypeMap.put(DbType.LONGVARBINARY, dbBytea);
|
||||
|
||||
@@ -21,6 +21,8 @@ public class SqlServer16Platform extends SqlServerBasePlatform {
|
||||
dbTypeMap.put(DbType.VARCHAR, new DbPlatformType("varchar", 255));
|
||||
dbTypeMap.put(DbType.LONGVARCHAR, new DbPlatformType("text"));
|
||||
dbTypeMap.put(DbType.CLOB, new DbPlatformType("text"));
|
||||
dbTypeMap.put(DbType.JSON, new DbPlatformType("text"));
|
||||
dbTypeMap.put(DbType.JSONB, new DbPlatformType("text"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-4
@@ -57,7 +57,6 @@ abstract class SqlServerBasePlatform extends DatabasePlatform {
|
||||
this.dbDefaultValue.setTrue("1");
|
||||
this.dbDefaultValue.setNow("SYSUTCDATETIME()");
|
||||
dbTypeMap.put(DbType.BOOLEAN, new DbPlatformType("bit"));
|
||||
|
||||
dbTypeMap.put(DbType.INTEGER, new DbPlatformType("integer", false));
|
||||
dbTypeMap.put(DbType.BIGINT, new DbPlatformType("numeric", 19));
|
||||
dbTypeMap.put(DbType.REAL, new DbPlatformType("float(16)"));
|
||||
@@ -67,16 +66,14 @@ abstract class SqlServerBasePlatform extends DatabasePlatform {
|
||||
dbTypeMap.put(DbType.DATE, new DbPlatformType("date"));
|
||||
dbTypeMap.put(DbType.TIME, new DbPlatformType("time"));
|
||||
dbTypeMap.put(DbType.TIMESTAMP, new DbPlatformType("datetime2"));
|
||||
|
||||
dbTypeMap.put(DbType.LOCALDATETIME, new DbPlatformType("datetime2"));
|
||||
// UTF8 aware types - overwritten in SqlServer16 platform
|
||||
dbTypeMap.put(DbType.CHAR, new DbPlatformType("nchar", 1));
|
||||
dbTypeMap.put(DbType.VARCHAR, new DbPlatformType("nvarchar", 255));
|
||||
dbTypeMap.put(DbType.LONGVARCHAR, new DbPlatformType("nvarchar", Integer.MAX_VALUE));
|
||||
dbTypeMap.put(DbType.CLOB, new DbPlatformType("nvarchar", Integer.MAX_VALUE));
|
||||
|
||||
dbTypeMap.put(DbType.JSON, new DbPlatformType("nvarchar", Integer.MAX_VALUE));
|
||||
dbTypeMap.put(DbType.JSONB, new DbPlatformType("nvarchar", Integer.MAX_VALUE));
|
||||
|
||||
dbTypeMap.put(DbType.BLOB, new DbPlatformType("image"));
|
||||
dbTypeMap.put(DbType.LONGVARBINARY, new DbPlatformType("image"));
|
||||
}
|
||||
|
||||
@@ -20,18 +20,13 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
*/
|
||||
public final class ShutdownManager {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ShutdownManager.class);
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger("io.ebean");
|
||||
private static final ReentrantLock lock = new ReentrantLock();
|
||||
|
||||
private static final List<Database> databases = new ArrayList<>();
|
||||
|
||||
private static final ShutdownHook shutdownHook = new ShutdownHook();
|
||||
|
||||
private static boolean stopping;
|
||||
|
||||
private static SpiContainer container;
|
||||
|
||||
static {
|
||||
// Register the Shutdown hook
|
||||
registerShutdownHook();
|
||||
@@ -125,8 +120,8 @@ public final class ShutdownManager {
|
||||
// Already run shutdown...
|
||||
return;
|
||||
}
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Shutting down");
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Ebean shutting down");
|
||||
}
|
||||
stopping = true;
|
||||
deregisterShutdownHook();
|
||||
@@ -138,7 +133,7 @@ public final class ShutdownManager {
|
||||
Runnable r = (Runnable) ClassUtil.newInstance(shutdownRunner);
|
||||
r.run();
|
||||
} catch (Exception e) {
|
||||
logger.error("Error running custom shutdown runnable", e);
|
||||
log.error("Error running custom shutdown runnable", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +147,7 @@ public final class ShutdownManager {
|
||||
try {
|
||||
server.shutdown();
|
||||
} catch (Exception ex) {
|
||||
logger.error("Error executing shutdown runnable", ex);
|
||||
log.error("Error executing shutdown runnable", ex);
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -170,10 +165,10 @@ public final class ShutdownManager {
|
||||
while (drivers.hasMoreElements()) {
|
||||
Driver driver = drivers.nextElement();
|
||||
try {
|
||||
logger.info("De-registering jdbc driver: " + driver);
|
||||
log.info("De-registering jdbc driver: " + driver);
|
||||
DriverManager.deregisterDriver(driver);
|
||||
} catch (SQLException e) {
|
||||
logger.error("Error de-registering driver " + driver, e);
|
||||
log.error("Error de-registering driver " + driver, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.slf4j.LoggerFactory;
|
||||
*/
|
||||
public class DefaultCsvCallback<T> implements CsvCallback<T> {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(DefaultCsvCallback.class);
|
||||
private static final Logger log = LoggerFactory.getLogger(DefaultCsvCallback.class);
|
||||
|
||||
/**
|
||||
* The transaction to use (if not using CsvCallback).
|
||||
@@ -124,13 +124,11 @@ public class DefaultCsvCallback<T> implements CsvCallback<T> {
|
||||
*/
|
||||
@Override
|
||||
public void processBean(int row, String[] line, T bean) {
|
||||
|
||||
// assumes single bean or Cascade.PERSIST will save any
|
||||
// related beans (e.g. customer -> customer.billingAddress
|
||||
server.save(bean, transaction);
|
||||
|
||||
if (logInfoFrequency > 0 && (row % logInfoFrequency == 0)) {
|
||||
logger.info("processed " + row + " rows");
|
||||
log.debug("processed {} rows", row);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,11 +137,9 @@ public class DefaultCsvCallback<T> implements CsvCallback<T> {
|
||||
*/
|
||||
@Override
|
||||
public void end(int row) {
|
||||
|
||||
commitTransactionIfCreated();
|
||||
|
||||
exeTime = System.currentTimeMillis() - startTime;
|
||||
logger.info("Csv finished, rows[" + row + "] exeMillis[" + exeTime + "]");
|
||||
log.info("Csv finished, rows[{}] exeMillis[{}]", row, exeTime);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -159,23 +155,20 @@ public class DefaultCsvCallback<T> implements CsvCallback<T> {
|
||||
* and batch size.
|
||||
*/
|
||||
protected void initTransactionIfRequired() {
|
||||
|
||||
transaction = server.currentTransaction();
|
||||
if (transaction == null || !transaction.isActive()) {
|
||||
|
||||
transaction = server.beginTransaction();
|
||||
createdTransaction = true;
|
||||
if (persistBatchSize > 1) {
|
||||
logger.info("Creating transaction, batchSize[" + persistBatchSize + "]");
|
||||
log.debug("Creating transaction, batchSize[{}]", persistBatchSize);
|
||||
transaction.setBatchMode(true);
|
||||
transaction.setBatchSize(persistBatchSize);
|
||||
transaction.setGetGeneratedKeys(false);
|
||||
|
||||
} else {
|
||||
// explicitly turn off JDBC batching in case
|
||||
// is has been turned on globally
|
||||
transaction.setBatchMode(false);
|
||||
logger.info("Creating transaction with no JDBC batching");
|
||||
log.debug("Creating transaction with no JDBC batching");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -187,7 +180,7 @@ public class DefaultCsvCallback<T> implements CsvCallback<T> {
|
||||
protected void commitTransactionIfCreated() {
|
||||
if (createdTransaction) {
|
||||
transaction.commit();
|
||||
logger.info("Committed transaction");
|
||||
log.debug("Committed transaction");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,7 +191,7 @@ public class DefaultCsvCallback<T> implements CsvCallback<T> {
|
||||
protected void rollbackTransactionIfCreated(Throwable e) {
|
||||
if (createdTransaction) {
|
||||
transaction.rollback(e);
|
||||
logger.info("Rolled back transaction");
|
||||
log.debug("Rolled back transaction");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.sql.Statement;
|
||||
*/
|
||||
public class JdbcClose {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(JdbcClose.class);
|
||||
private static final Logger log = LoggerFactory.getLogger("io.ebean");
|
||||
|
||||
/**
|
||||
* Close the resultSet logging if an error occurs.
|
||||
@@ -24,7 +24,7 @@ public class JdbcClose {
|
||||
statement.close();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
logger.warn("Error closing statement", e);
|
||||
log.warn("Error closing statement", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class JdbcClose {
|
||||
resultSet.close();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
logger.warn("Error closing resultSet", e);
|
||||
log.warn("Error closing resultSet", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class JdbcClose {
|
||||
connection.close();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
logger.warn("Error closing connection", e);
|
||||
log.warn("Error closing connection", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class JdbcClose {
|
||||
connection.rollback();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
logger.warn("Error on connection rollback", e);
|
||||
log.warn("Error on connection rollback", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public class JdbcClose {
|
||||
stmt.cancel();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
logger.warn("Error on cancelling statement", e);
|
||||
log.warn("Error on cancelling statement", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
module io.ebean.api {
|
||||
|
||||
uses io.ebean.config.AutoConfigure;
|
||||
uses io.ebean.datasource.DataSourceAlertFactory;
|
||||
uses io.ebean.metric.MetricFactory;
|
||||
uses io.ebean.service.SpiContainerFactory;
|
||||
uses io.ebean.service.SpiRawSqlService;
|
||||
uses io.ebean.service.SpiProfileLocationFactory;
|
||||
uses io.ebean.service.SpiFetchGroupService;
|
||||
|
||||
requires transitive java.sql;
|
||||
requires transitive io.avaje.config;
|
||||
requires transitive persistence.api;
|
||||
requires transitive io.ebean.annotation;
|
||||
requires transitive io.ebean.datasource.api;
|
||||
requires transitive org.slf4j;
|
||||
|
||||
requires static io.ebean.types;
|
||||
requires static io.avaje.jsr305x;
|
||||
requires static com.fasterxml.jackson.core;
|
||||
requires static javax.servlet.api;
|
||||
requires static com.h2database;
|
||||
|
||||
exports io.ebean;
|
||||
exports io.ebean.bean;
|
||||
exports io.ebean.cache;
|
||||
exports io.ebean.meta;
|
||||
exports io.ebean.config;
|
||||
exports io.ebean.config.dbplatform;
|
||||
exports io.ebean.config.dbplatform.clickhouse;
|
||||
exports io.ebean.config.dbplatform.h2;
|
||||
exports io.ebean.config.dbplatform.db2;
|
||||
exports io.ebean.config.dbplatform.cockroach;
|
||||
exports io.ebean.config.dbplatform.hana;
|
||||
exports io.ebean.config.dbplatform.hsqldb;
|
||||
exports io.ebean.config.dbplatform.mariadb;
|
||||
exports io.ebean.config.dbplatform.mysql;
|
||||
exports io.ebean.config.dbplatform.nuodb;
|
||||
exports io.ebean.config.dbplatform.oracle;
|
||||
exports io.ebean.config.dbplatform.postgres;
|
||||
exports io.ebean.config.dbplatform.sqlanywhere;
|
||||
exports io.ebean.config.dbplatform.sqlite;
|
||||
exports io.ebean.config.dbplatform.sqlserver;
|
||||
exports io.ebean.event;
|
||||
exports io.ebean.event.readaudit;
|
||||
exports io.ebean.event.changelog;
|
||||
exports io.ebean.common;
|
||||
exports io.ebean.docstore;
|
||||
exports io.ebean.plugin;
|
||||
exports io.ebean.metric;
|
||||
exports io.ebean.search;
|
||||
exports io.ebean.service;
|
||||
exports io.ebean.text;
|
||||
exports io.ebean.text.json;
|
||||
exports io.ebean.text.csv;
|
||||
exports io.ebean.util;
|
||||
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
Manifest-Version: 1.0
|
||||
Automatic-Module-Name: io.ebean.api
|
||||
@@ -0,0 +1,31 @@
|
||||
package io.ebean;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
class EbeanVersionTest {
|
||||
|
||||
@Test
|
||||
void checkMinAgentVersion_ok() {
|
||||
assertFalse(EbeanVersion.checkMinAgentVersion("12.12.0"));
|
||||
assertFalse(EbeanVersion.checkMinAgentVersion("12.12.99"));
|
||||
assertFalse(EbeanVersion.checkMinAgentVersion("13.1.0"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void checkMinAgentVersion_agentTooOld() {
|
||||
assertTrue(EbeanVersion.checkMinAgentVersion("11.13.0"));
|
||||
assertTrue(EbeanVersion.checkMinAgentVersion("12.11.0"));
|
||||
assertTrue(EbeanVersion.checkMinAgentVersion("12.11.99"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void checkMinAgentVersion_unexpectedAgentVersion() {
|
||||
assertTrue(EbeanVersion.checkMinAgentVersion("13.13"));
|
||||
assertTrue(EbeanVersion.checkMinAgentVersion("13"));
|
||||
assertTrue(EbeanVersion.checkMinAgentVersion(""));
|
||||
}
|
||||
|
||||
}
|
||||
+4
-15
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.11.5</version>
|
||||
<version>12.12.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.5</tag>
|
||||
<tag>ebean-parent-12.12.2</tag>
|
||||
</scm>
|
||||
|
||||
<name>ebean autotune</name>
|
||||
@@ -26,7 +26,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>12.11.5</version>
|
||||
<version>12.12.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -63,23 +63,12 @@
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<tiles>
|
||||
<!-- other tiles ... -->
|
||||
<tile>io.ebean.tile:enhancement:12.11.3</tile>
|
||||
<tile>io.avaje.tile:moditech-module:1.0</tile>
|
||||
</tiles>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.5</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
<!-- <parent>-->
|
||||
<!-- <groupId>org.avaje</groupId>-->
|
||||
<!-- <artifactId>java8-oss</artifactId>-->
|
||||
<!-- <version>2.2</version>-->
|
||||
<!-- </parent>-->
|
||||
|
||||
<scm>
|
||||
<developerConnection>scm:git:git@github.com:ebean-orm/ebean.git</developerConnection>
|
||||
<tag>HEAD</tag>
|
||||
</scm>
|
||||
|
||||
<name>ebean autotune</name>
|
||||
<description>ebean automatic query tuning module</description>
|
||||
<artifactId>ebean-autotune</artifactId>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- needed for java 11+ -->
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>jaxb-runtime</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-datasource</artifactId>
|
||||
<version>${ebean-datasource.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>io.repaint.maven</groupId>
|
||||
<artifactId>tiles-maven-plugin</artifactId>
|
||||
<version>2.24</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<tiles>
|
||||
<tile>io.ebean.tile:enhancement:12.11.3</tile>
|
||||
<tile>io.avaje.tile:moditech-module:1.0</tile>
|
||||
</tiles>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,15 @@
|
||||
import io.ebeaninternal.server.autotune.AutoTuneServiceProvider;
|
||||
import io.ebeaninternal.server.autotune.service.AutoTuneServiceFactory;
|
||||
|
||||
/**
|
||||
* Provider of AutoTuneServiceProvider
|
||||
*/
|
||||
module io.ebean.autotune {
|
||||
|
||||
provides AutoTuneServiceProvider with AutoTuneServiceFactory;
|
||||
|
||||
requires io.ebean.api;
|
||||
requires io.ebean.core;
|
||||
requires java.xml;
|
||||
requires java.xml.bind;
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
Manifest-Version: 1.0
|
||||
Automatic-Module-Name: io.ebean.autotune
|
||||
+15
-15
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.11.5</version>
|
||||
<version>12.12.2</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean bom</name>
|
||||
@@ -71,88 +71,88 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean</artifactId>
|
||||
<version>12.11.5</version>
|
||||
<version>12.12.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>12.11.5</version>
|
||||
<version>12.12.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>12.11.5</version>
|
||||
<version>12.12.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>12.11.5</version>
|
||||
<version>12.12.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-generator</artifactId>
|
||||
<version>12.11.5</version>
|
||||
<version>12.12.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-externalmapping-api</artifactId>
|
||||
<version>12.11.5</version>
|
||||
<version>12.12.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-externalmapping-xml</artifactId>
|
||||
<version>12.11.5</version>
|
||||
<version>12.12.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-autotune</artifactId>
|
||||
<version>12.11.5</version>
|
||||
<version>12.12.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>12.11.5</version>
|
||||
<version>12.12.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>querybean-generator</artifactId>
|
||||
<version>12.11.5</version>
|
||||
<version>12.12.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>kotlin-querybean-generator</artifactId>
|
||||
<version>12.11.5</version>
|
||||
<version>12.12.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
<version>12.11.5</version>
|
||||
<version>12.12.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-postgis</artifactId>
|
||||
<version>12.11.5</version>
|
||||
<version>12.12.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-redis</artifactId>
|
||||
<version>12.11.5</version>
|
||||
<version>12.12.2</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -0,0 +1,162 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean bom</name>
|
||||
<description>ebean bill of materials pom</description>
|
||||
<artifactId>ebean-bom</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- dependencies external to this ebean.git build -->
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-runner</artifactId>
|
||||
<version>${ebean-ddl-runner.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-migration-auto</artifactId>
|
||||
<version>${ebean-migration-auto.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-migration</artifactId>
|
||||
<version>${ebean-migration.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-datasource-api</artifactId>
|
||||
<version>${ebean-datasource.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-datasource</artifactId>
|
||||
<version>${ebean-datasource.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-agent</artifactId>
|
||||
<version>${ebean-agent.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-maven-plugin</artifactId>
|
||||
<version>${ebean-maven-plugin.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test-docker</artifactId>
|
||||
<version>${ebean-test-docker.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- modules -->
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-generator</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-externalmapping-api</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-externalmapping-xml</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-autotune</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>querybean-generator</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>kotlin-querybean-generator</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-postgis</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-redis</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</dependencyManagement>
|
||||
|
||||
</project>
|
||||
+17
-2
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.11.5</version>
|
||||
<version>12.12.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
@@ -16,7 +16,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>12.11.5</version>
|
||||
<version>12.12.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -28,4 +28,19 @@
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>io.repaint.maven</groupId>
|
||||
<artifactId>tiles-maven-plugin</artifactId>
|
||||
<version>2.24</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<tiles>
|
||||
<tile>io.avaje.tile:moditech-module:1.0</tile>
|
||||
</tiles>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<name>ebean core type</name>
|
||||
<description>ebean scalar types api</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>io.repaint.maven</groupId>
|
||||
<artifactId>tiles-maven-plugin</artifactId>
|
||||
<version>2.24</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<tiles>
|
||||
<tile>io.avaje.tile:moditech-module:1.0</tile>
|
||||
</tiles>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,10 @@
|
||||
module io.ebean.core.type {
|
||||
|
||||
exports io.ebean.core.type;
|
||||
|
||||
requires transitive java.sql;
|
||||
requires transitive io.ebean.api;
|
||||
|
||||
requires static com.fasterxml.jackson.core;
|
||||
|
||||
}
|
||||
+18
-17
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.11.5</version>
|
||||
<version>12.12.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.5</tag>
|
||||
<tag>ebean-parent-12.12.2</tag>
|
||||
</scm>
|
||||
|
||||
<dependencies>
|
||||
@@ -29,7 +29,7 @@
|
||||
<dependency>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>classpath-scanner</artifactId>
|
||||
<version>6.1</version>
|
||||
<version>6.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -41,19 +41,19 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>12.11.5</version>
|
||||
<version>12.12.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>12.11.5</version>
|
||||
<version>12.12.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-externalmapping-api</artifactId>
|
||||
<version>12.11.5</version>
|
||||
<version>12.12.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -207,17 +207,6 @@
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.5</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
@@ -239,6 +228,18 @@
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>io.repaint.maven</groupId>
|
||||
<artifactId>tiles-maven-plugin</artifactId>
|
||||
<version>2.24</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<tiles>
|
||||
<tile>io.avaje.tile:moditech-module:1.0</tile>
|
||||
</tiles>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
|
||||
</build>
|
||||
|
||||
@@ -0,0 +1,247 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>ebean core</name>
|
||||
<description>ebean core module</description>
|
||||
<url>https://ebean.io/</url>
|
||||
|
||||
<scm>
|
||||
<developerConnection>scm:git:git@github.com:ebean-orm/ebean.git</developerConnection>
|
||||
<tag>HEAD</tag>
|
||||
</scm>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-runner</artifactId>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>classpath-scanner</artifactId>
|
||||
<version>6.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-migration-auto</artifactId>
|
||||
<version>1.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-externalmapping-api</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.antlr</groupId>
|
||||
<artifactId>antlr4-runtime</artifactId>
|
||||
<version>4.8-1</version>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
Class retention Nonnull and Nullable annotations
|
||||
to assist with IDE auto-completion with Ebean API
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>avaje-jsr305-x</artifactId>
|
||||
<version>1.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Provided scope so that the H2HistoryTrigger can live in Ebean core
|
||||
and not require a separate module for it -->
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<version>1.4.199</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.transaction</groupId>
|
||||
<artifactId>javax.transaction-api</artifactId>
|
||||
<version>1.3</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- validation annotations Size etc -->
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
<version>2.0.1.Final</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.validation</groupId>
|
||||
<artifactId>jakarta.validation-api</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>joda-time</groupId>
|
||||
<artifactId>joda-time</artifactId>
|
||||
<version>2.9.7</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>javax.annotation</groupId>-->
|
||||
<!-- <artifactId>javax.annotation-api</artifactId>-->
|
||||
<!-- <version>1.3.2</version>-->
|
||||
<!-- <optional>true</optional>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- Jackson core used internally by Ebean -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- Provided scope for Postgres JSON/JSONB support -->
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>42.2.20</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- Test scope -->
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-datasource</artifactId>
|
||||
<version>${ebean-datasource.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
<plugin>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-maven-plugin</artifactId>
|
||||
<version>${ebean-maven-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>test</id>
|
||||
<phase>process-test-classes</phase>
|
||||
<configuration>
|
||||
<transformArgs>debug=0</transformArgs>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>testEnhance</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<configuration>
|
||||
<useSystemClassLoader>false</useSystemClassLoader>
|
||||
<trimStackTrace>false</trimStackTrace>
|
||||
<failIfNoTests>false</failIfNoTests>
|
||||
<includes>
|
||||
<include>**/Test*.java</include>
|
||||
<include>**/*Test.java</include>
|
||||
<include>**/*Tests.java</include>
|
||||
</includes>
|
||||
<systemProperties>
|
||||
<property>
|
||||
<!-- transfer datasource.default parameter -->
|
||||
<name>datasource.default</name>
|
||||
<value>${datasource.default}</value>
|
||||
</property>
|
||||
<property>
|
||||
<!-- transfer dbClockDelta parameter -->
|
||||
<name>dbClockDelta</name>
|
||||
<value>${dbClockDelta}</value>
|
||||
</property>
|
||||
</systemProperties>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<configuration>
|
||||
<doctitle>Ebean 12</doctitle>
|
||||
<overview>src/main/java/io/ebean/overview.html</overview>
|
||||
<excludePackageNames>io.ebeaninternal.*:io.ebeanservice:io.ebean.common:io.ebean.bean:io.ebean.service:io.ebean.metric:io.ebean.util:io.ebean.config.properties:io.ebean.config.dbplatform</excludePackageNames>
|
||||
<linksource>true</linksource>
|
||||
<overview>src/main/java/com/avaje/ebean/overview.html</overview>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>io.repaint.maven</groupId>
|
||||
<artifactId>tiles-maven-plugin</artifactId>
|
||||
<version>2.24</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<tiles>
|
||||
<tile>io.avaje.tile:moditech-module:1.0</tile>
|
||||
</tiles>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -285,12 +285,17 @@ public final class BindParams implements Serializable {
|
||||
*/
|
||||
public boolean isSameBindHash() {
|
||||
if (bindHash == null) {
|
||||
bindHash = calcQueryPlanHash();
|
||||
return false;
|
||||
}
|
||||
String oldPlan = bindHash;
|
||||
String newHash = calcQueryPlanHash();
|
||||
return bindHash.equals(newHash);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the hash.
|
||||
*/
|
||||
public void updateHash() {
|
||||
bindHash = calcQueryPlanHash();
|
||||
return bindHash.equals(oldPlan);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.ebeaninternal.api;
|
||||
|
||||
import io.ebeaninternal.server.expression.IdInExpression;
|
||||
import io.ebeaninternal.server.expression.IdInCommon;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -13,10 +13,10 @@ import java.util.Set;
|
||||
*/
|
||||
public final class CacheIdLookupMany<T> implements CacheIdLookup<T> {
|
||||
|
||||
private final IdInExpression idInExpression;
|
||||
private final IdInCommon idInExpression;
|
||||
private int remaining;
|
||||
|
||||
public CacheIdLookupMany(IdInExpression idInExpression) {
|
||||
public CacheIdLookupMany(IdInCommon idInExpression) {
|
||||
this.idInExpression = idInExpression;
|
||||
}
|
||||
|
||||
@@ -34,15 +34,12 @@ public final class CacheIdLookupMany<T> implements CacheIdLookup<T> {
|
||||
*/
|
||||
@Override
|
||||
public List<T> removeHits(BeanCacheResult<T> cacheResult) {
|
||||
|
||||
Set<Object> hitIds = new HashSet<>();
|
||||
List<T> beans = new ArrayList<>(hitIds.size());
|
||||
|
||||
for (BeanCacheResult.Entry<T> hit : cacheResult.hits()) {
|
||||
hitIds.add(hit.getKey());
|
||||
beans.add(hit.getBean());
|
||||
}
|
||||
|
||||
this.remaining = idInExpression.removeIds(hitIds);
|
||||
return beans;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package io.ebeaninternal.api;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Common loggers used in ebean-core.
|
||||
*/
|
||||
public final class CoreLog {
|
||||
|
||||
public static final Logger log = LoggerFactory.getLogger("io.ebean.core");
|
||||
public static final Logger internal = LoggerFactory.getLogger("io.ebean.internal");
|
||||
}
|
||||
@@ -8,7 +8,6 @@ import io.ebeaninternal.server.core.OrmQueryRequest;
|
||||
import io.ebeaninternal.server.deploy.BeanDescriptor;
|
||||
import io.ebeaninternal.server.deploy.BeanPropertyAssocMany;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -18,7 +17,7 @@ import java.util.List;
|
||||
*/
|
||||
public final class LoadManyRequest extends LoadRequest {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(LoadManyRequest.class);
|
||||
private static final Logger log = CoreLog.log;
|
||||
|
||||
private final List<BeanCollection<?>> batch;
|
||||
private final LoadManyBuffer loadContext;
|
||||
@@ -114,10 +113,10 @@ public final class LoadManyRequest extends LoadRequest {
|
||||
// in the +query or +lazy load due to no rows (predicates)
|
||||
for (BeanCollection<?> bc : batch) {
|
||||
if (bc.checkEmptyLazyLoad()) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
if (log.isDebugEnabled()) {
|
||||
EntityBean ownerBean = bc.getOwnerBean();
|
||||
Object parentId = desc.getId(ownerBean);
|
||||
logger.debug("BeanCollection after lazy load was empty. type:" + ownerBean.getClass().getName() + " id:" + parentId + " owner:" + ownerBean);
|
||||
log.debug("BeanCollection after lazy load was empty. type:" + ownerBean.getClass().getName() + " id:" + parentId + " owner:" + ownerBean);
|
||||
}
|
||||
} else if (loadCache && many.isUseCache()) {
|
||||
desc.cacheManyPropPut(many, bc, desc.getId(bc.getOwnerBean()));
|
||||
|
||||
@@ -20,17 +20,17 @@ public interface SpiTransactionManager {
|
||||
/**
|
||||
* Return the main DataSource.
|
||||
*/
|
||||
DataSource getDataSource();
|
||||
DataSource dataSource();
|
||||
|
||||
/**
|
||||
* Return the read only DataSource (if defined).
|
||||
*/
|
||||
DataSource getReadOnlyDataSource();
|
||||
DataSource readOnlyDataSource();
|
||||
|
||||
/**
|
||||
* Return the currently active transaction (can be null).
|
||||
*/
|
||||
SpiTransaction getActive();
|
||||
SpiTransaction active();
|
||||
|
||||
/**
|
||||
* Push an externally managed transaction into scope (e.g. Spring managed transaction).
|
||||
@@ -60,6 +60,6 @@ public interface SpiTransactionManager {
|
||||
/**
|
||||
* Return a connection used for query plan collection.
|
||||
*/
|
||||
Connection getQueryPlanConnection() throws SQLException;
|
||||
Connection queryPlanConnection() throws SQLException;
|
||||
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ public final class TransactionEvent implements Serializable {
|
||||
}
|
||||
if (eventTables != null && !eventTables.isEmpty()) {
|
||||
// notify cache with table based changes
|
||||
BeanDescriptorManager dm = manager.getBeanDescriptorManager();
|
||||
BeanDescriptorManager dm = manager.descriptorManager();
|
||||
for (TransactionEventTable.TableIUD tableIUD : eventTables.values()) {
|
||||
dm.cacheNotify(tableIUD, changeSet);
|
||||
}
|
||||
|
||||
+2
-11
@@ -6,6 +6,7 @@ import io.ebean.event.changelog.ChangeSet;
|
||||
import io.ebean.event.changelog.ChangeType;
|
||||
import io.ebean.plugin.Plugin;
|
||||
import io.ebean.plugin.SpiServer;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -17,11 +18,6 @@ import java.util.Properties;
|
||||
*/
|
||||
public final class DefaultChangeLogListener implements ChangeLogListener, Plugin {
|
||||
|
||||
/**
|
||||
* The usual application specific logger.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
@@ -37,9 +33,6 @@ public final class DefaultChangeLogListener implements ChangeLogListener, Plugin
|
||||
*/
|
||||
private int defaultBufferSize = 400;
|
||||
|
||||
public DefaultChangeLogListener() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the underlying JSON handler.
|
||||
*/
|
||||
@@ -67,7 +60,6 @@ public final class DefaultChangeLogListener implements ChangeLogListener, Plugin
|
||||
|
||||
@Override
|
||||
public void log(ChangeSet changeSet) {
|
||||
|
||||
for (BeanChange beanChange : changeSet.getChanges()) {
|
||||
// log each bean change as a separate log entry
|
||||
try {
|
||||
@@ -75,7 +67,7 @@ public final class DefaultChangeLogListener implements ChangeLogListener, Plugin
|
||||
jsonBuilder.writeBeanJson(writer, beanChange, changeSet);
|
||||
changeLog.info(writer.toString());
|
||||
} catch (Exception e) {
|
||||
logger.error("Exception logging beanChange " + beanChange.toString(), e);
|
||||
CoreLog.log.error("Exception logging beanChange " + beanChange, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,7 +76,6 @@ public final class DefaultChangeLogListener implements ChangeLogListener, Plugin
|
||||
* Return a decent buffer size based on the bean change.
|
||||
*/
|
||||
private int getBufferSize(BeanChange beanChange) {
|
||||
|
||||
return ChangeType.DELETE == beanChange.getEvent() ? 250 : defaultBufferSize;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
package io.ebeaninternal.server.core;
|
||||
|
||||
import io.ebean.EbeanServer;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.api.SpiEbeanServer;
|
||||
import io.ebeaninternal.api.SpiTransaction;
|
||||
import io.ebeaninternal.server.core.timezone.DataTimeZone;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Base class for find and persist requests.
|
||||
*/
|
||||
public abstract class BeanRequest {
|
||||
|
||||
static final Logger log = LoggerFactory.getLogger(BeanRequest.class);
|
||||
|
||||
protected final SpiEbeanServer server;
|
||||
protected SpiTransaction transaction;
|
||||
protected boolean createdTransaction;
|
||||
@@ -64,7 +61,7 @@ public abstract class BeanRequest {
|
||||
// Just log this and carry on. A previous exception has been
|
||||
// thrown and if this rollback throws exception it likely means
|
||||
// that the connection is broken (and the dataSource and db will cleanup)
|
||||
log.error("Error trying to rollback a transaction (after a prior exception thrown)", e);
|
||||
CoreLog.log.error("Error trying to rollback a transaction (after a prior exception thrown)", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,9 @@ import io.avaje.classpath.scanner.ClassPathScannerFactory;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
/**
|
||||
* Utility to finds and return the list of ClassPathScanner services.
|
||||
@@ -17,7 +19,7 @@ public class ClassPathScanners {
|
||||
*/
|
||||
public static List<ClassPathScanner> find(DatabaseConfig config) {
|
||||
List<ClassPathScanner> scanners = new ArrayList<>();
|
||||
for (ClassPathScannerFactory factory : config.serviceLoad(ClassPathScannerFactory.class)) {
|
||||
for (ClassPathScannerFactory factory : ServiceLoader.load(ClassPathScannerFactory.class)) {
|
||||
scanners.add(factory.createScanner(config.getClassLoadConfig().getClassLoader()));
|
||||
}
|
||||
return scanners;
|
||||
|
||||
@@ -20,10 +20,8 @@ import io.ebean.config.dbplatform.sqlanywhere.SqlAnywherePlatform;
|
||||
import io.ebean.config.dbplatform.sqlite.SQLitePlatform;
|
||||
import io.ebean.config.dbplatform.sqlserver.SqlServer16Platform;
|
||||
import io.ebean.config.dbplatform.sqlserver.SqlServer17Platform;
|
||||
import io.ebean.util.JdbcClose;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.api.DbOffline;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.sql.DataSource;
|
||||
@@ -41,8 +39,6 @@ import java.sql.SQLException;
|
||||
*/
|
||||
public class DatabasePlatformFactory {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(DatabasePlatformFactory.class);
|
||||
|
||||
/**
|
||||
* Create the appropriate database specific platform.
|
||||
*/
|
||||
@@ -50,7 +46,7 @@ public class DatabasePlatformFactory {
|
||||
try {
|
||||
String offlinePlatform = DbOffline.getPlatform();
|
||||
if (offlinePlatform != null) {
|
||||
logger.info("offline platform [{}]", offlinePlatform);
|
||||
CoreLog.log.info("offline platform [{}]", offlinePlatform);
|
||||
return byDatabaseName(offlinePlatform);
|
||||
}
|
||||
if (config.getDatabasePlatformName() != null) {
|
||||
@@ -142,7 +138,7 @@ public class DatabasePlatformFactory {
|
||||
String dbProductName = metaData.getDatabaseProductName().toLowerCase();
|
||||
final int majorVersion = metaData.getDatabaseMajorVersion();
|
||||
final int minorVersion = metaData.getDatabaseMinorVersion();
|
||||
logger.debug("platform for productName[{}] version[{}.{}]", dbProductName, majorVersion, minorVersion);
|
||||
CoreLog.log.debug("platform for productName[{}] version[{}.{}]", dbProductName, majorVersion, minorVersion);
|
||||
|
||||
if (dbProductName.contains("oracle")) {
|
||||
return oracleVersion(majorVersion);
|
||||
@@ -201,7 +197,7 @@ public class DatabasePlatformFactory {
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
logger.warn("Error running detection query on Postgres", e);
|
||||
CoreLog.log.warn("Error running detection query on Postgres", e);
|
||||
}
|
||||
if (majorVersion <= 9) {
|
||||
return new Postgres9Platform();
|
||||
|
||||
@@ -7,18 +7,13 @@ import io.ebean.bean.BeanCollection;
|
||||
import io.ebean.bean.EntityBean;
|
||||
import io.ebean.bean.EntityBeanIntercept;
|
||||
import io.ebean.bean.PersistenceContext;
|
||||
import io.ebeaninternal.api.LoadBeanRequest;
|
||||
import io.ebeaninternal.api.LoadManyRequest;
|
||||
import io.ebeaninternal.api.LoadRequest;
|
||||
import io.ebeaninternal.api.SpiQuery;
|
||||
import io.ebeaninternal.api.*;
|
||||
import io.ebeaninternal.api.SpiQuery.Mode;
|
||||
import io.ebeaninternal.api.SpiTransaction;
|
||||
import io.ebeaninternal.server.deploy.BeanDescriptor;
|
||||
import io.ebeaninternal.server.deploy.BeanDescriptor.EntityType;
|
||||
import io.ebeaninternal.server.deploy.BeanPropertyAssocMany;
|
||||
import io.ebeaninternal.server.transaction.DefaultPersistenceContext;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.persistence.EntityNotFoundException;
|
||||
import java.util.List;
|
||||
@@ -28,7 +23,7 @@ import java.util.List;
|
||||
*/
|
||||
final class DefaultBeanLoader {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(DefaultBeanLoader.class);
|
||||
private static final Logger log = CoreLog.internal;
|
||||
|
||||
private final DefaultServer server;
|
||||
private final boolean onIterateUseExtraTxn;
|
||||
@@ -113,8 +108,8 @@ final class DefaultBeanLoader {
|
||||
server.findOne(query, t);
|
||||
if (beanCollection != null) {
|
||||
if (beanCollection.checkEmptyLazyLoad()) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("BeanCollection after load was empty. Owner:" + beanCollection.getOwnerBean());
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("BeanCollection after load was empty. Owner:" + beanCollection.getOwnerBean());
|
||||
}
|
||||
} else if (useManyIdCache) {
|
||||
parentDesc.cacheManyPropPut(many, beanCollection, parentId);
|
||||
|
||||
@@ -12,6 +12,7 @@ import io.ebean.config.dbplatform.DatabasePlatform;
|
||||
import io.ebean.config.dbplatform.h2.H2Platform;
|
||||
import io.ebean.event.ShutdownManager;
|
||||
import io.ebean.service.SpiContainer;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.api.DbOffline;
|
||||
import io.ebeaninternal.api.SpiBackgroundExecutor;
|
||||
import io.ebeaninternal.api.SpiEbeanServer;
|
||||
@@ -20,7 +21,6 @@ import io.ebeaninternal.server.core.bootup.BootupClassPathSearch;
|
||||
import io.ebeaninternal.server.core.bootup.BootupClasses;
|
||||
import io.ebeaninternal.server.executor.DefaultBackgroundExecutor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.sql.Connection;
|
||||
@@ -34,7 +34,7 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
*/
|
||||
public final class DefaultContainer implements SpiContainer {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger("io.ebean.DB");
|
||||
private static final Logger log = CoreLog.log;
|
||||
|
||||
private final ReentrantLock lock = new ReentrantLock();
|
||||
private final ClusterManager clusterManager;
|
||||
@@ -113,7 +113,7 @@ public final class DefaultContainer implements SpiContainer {
|
||||
startServer(online, server);
|
||||
}
|
||||
DbOffline.reset();
|
||||
logger.info("started database[{}] platform[{}] in {}ms", config.getName(), config.getDatabasePlatform().getPlatform(), System.currentTimeMillis() - start);
|
||||
log.info("Started database[{}] platform[{}] in {}ms", config.getName(), config.getDatabasePlatform().getPlatform(), System.currentTimeMillis() - start);
|
||||
return server;
|
||||
} finally {
|
||||
lock.unlock();
|
||||
@@ -215,7 +215,7 @@ public final class DefaultContainer implements SpiContainer {
|
||||
*/
|
||||
private void setDataSource(DatabaseConfig config) {
|
||||
if (isOfflineMode(config)) {
|
||||
logger.debug("... DbOffline using platform [{}]", DbOffline.getPlatform());
|
||||
log.debug("... DbOffline using platform [{}]", DbOffline.getPlatform());
|
||||
} else {
|
||||
InitDataSource.init(config);
|
||||
}
|
||||
@@ -251,7 +251,7 @@ public final class DefaultContainer implements SpiContainer {
|
||||
}
|
||||
try (Connection connection = config.getDataSource().getConnection()) {
|
||||
if (connection.getAutoCommit()) {
|
||||
logger.warn("DataSource [{}] has autoCommit defaulting to true!", config.getName());
|
||||
log.warn("DataSource [{}] has autoCommit defaulting to true!", config.getName());
|
||||
}
|
||||
return true;
|
||||
} catch (SQLException ex) {
|
||||
|
||||
@@ -63,26 +63,8 @@ import io.ebean.plugin.Property;
|
||||
import io.ebean.plugin.SpiServer;
|
||||
import io.ebean.text.csv.CsvReader;
|
||||
import io.ebean.text.json.JsonContext;
|
||||
import io.ebeaninternal.api.ExtraMetrics;
|
||||
import io.ebeaninternal.api.LoadBeanRequest;
|
||||
import io.ebeaninternal.api.LoadManyRequest;
|
||||
import io.ebeaninternal.api.QueryPlanManager;
|
||||
import io.ebeaninternal.api.ScopedTransaction;
|
||||
import io.ebeaninternal.api.SpiBackgroundExecutor;
|
||||
import io.ebeaninternal.api.SpiDdlGenerator;
|
||||
import io.ebeaninternal.api.SpiDtoQuery;
|
||||
import io.ebeaninternal.api.SpiEbeanServer;
|
||||
import io.ebeaninternal.api.SpiJsonContext;
|
||||
import io.ebeaninternal.api.SpiLogManager;
|
||||
import io.ebeaninternal.api.SpiQuery;
|
||||
import io.ebeaninternal.api.*;
|
||||
import io.ebeaninternal.api.SpiQuery.Type;
|
||||
import io.ebeaninternal.api.SpiQueryBindCapture;
|
||||
import io.ebeaninternal.api.SpiQueryPlan;
|
||||
import io.ebeaninternal.api.SpiSqlQuery;
|
||||
import io.ebeaninternal.api.SpiSqlUpdate;
|
||||
import io.ebeaninternal.api.SpiTransaction;
|
||||
import io.ebeaninternal.api.SpiTransactionManager;
|
||||
import io.ebeaninternal.api.TransactionEventTable;
|
||||
import io.ebeaninternal.server.autotune.AutoTuneService;
|
||||
import io.ebeaninternal.server.cache.RemoteCacheEvent;
|
||||
import io.ebeaninternal.server.core.timezone.DataTimeZone;
|
||||
@@ -118,7 +100,6 @@ import io.ebeaninternal.util.ParamTypeHelper;
|
||||
import io.ebeaninternal.util.ParamTypeHelper.TypeInfo;
|
||||
import io.ebeanservice.docstore.api.DocStoreIntegration;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.persistence.NonUniqueResultException;
|
||||
@@ -146,7 +127,7 @@ import static java.util.stream.StreamSupport.stream;
|
||||
*/
|
||||
public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(DefaultServer.class);
|
||||
private static final Logger log = CoreLog.internal;
|
||||
|
||||
private final ReentrantLock lock = new ReentrantLock();
|
||||
private final DatabaseConfig config;
|
||||
@@ -347,12 +328,12 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
|
||||
@Override
|
||||
public DataSource dataSource() {
|
||||
return transactionManager.getDataSource();
|
||||
return transactionManager.dataSource();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSource readOnlyDataSource() {
|
||||
return transactionManager.getReadOnlyDataSource();
|
||||
return transactionManager.readOnlyDataSource();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -380,7 +361,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
*/
|
||||
public void start() {
|
||||
if (config.isRunMigration() && TenantMode.DB != config.getTenantMode()) {
|
||||
final AutoMigrationRunner migrationRunner = config.service(AutoMigrationRunner.class);
|
||||
final AutoMigrationRunner migrationRunner = ServiceUtil.service(AutoMigrationRunner.class);
|
||||
if (migrationRunner == null) {
|
||||
throw new IllegalStateException("No AutoMigrationRunner found. Probably ebean-migration is not in the classpath?");
|
||||
}
|
||||
@@ -400,7 +381,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
if (config.isQueryPlanCapture()) {
|
||||
long secs = config.getQueryPlanCapturePeriodSecs();
|
||||
if (secs > 10) {
|
||||
logger.info("capture query plan enabled, every {}secs", secs);
|
||||
log.info("capture query plan enabled, every {}secs", secs);
|
||||
backgroundExecutor.scheduleWithFixedDelay(this::collectQueryPlans, secs, secs, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
@@ -448,7 +429,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
* Shutdown the services like threads and DataSource.
|
||||
*/
|
||||
private void shutdownInternal(boolean shutdownDataSource, boolean deregisterDriver) {
|
||||
logger.debug("Shutting down instance:{}", serverName);
|
||||
log.trace("shutting down instance {}", serverName);
|
||||
if (shutdown) {
|
||||
// already shutdown
|
||||
return;
|
||||
@@ -477,7 +458,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
try {
|
||||
plugin.shutdown();
|
||||
} catch (Exception e) {
|
||||
logger.error("Error when shutting down plugin", e);
|
||||
log.error("Error when shutting down plugin", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -686,7 +667,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
BeanDescriptor desc = descriptor(type);
|
||||
id = desc.convertId(id);
|
||||
PersistenceContext pc = null;
|
||||
SpiTransaction t = transactionManager.getActive();
|
||||
SpiTransaction t = transactionManager.active();
|
||||
if (t != null) {
|
||||
pc = t.getPersistenceContext();
|
||||
Object existing = desc.contextGet(pc, id);
|
||||
@@ -787,7 +768,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
|
||||
@Override
|
||||
public SpiTransaction currentServerTransaction() {
|
||||
return transactionManager.getActive();
|
||||
return transactionManager.active();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -816,7 +797,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
|
||||
@Override
|
||||
public Transaction currentTransaction() {
|
||||
return transactionManager.getActive();
|
||||
return transactionManager.active();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -836,7 +817,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
|
||||
@Override
|
||||
public void endTransaction() {
|
||||
Transaction transaction = transactionManager.getInScope();
|
||||
Transaction transaction = transactionManager.inScope();
|
||||
if (transaction != null) {
|
||||
transaction.end();
|
||||
}
|
||||
@@ -2193,7 +2174,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
try {
|
||||
serverCacheManager.clearLocal(Class.forName(cache));
|
||||
} catch (Exception e) {
|
||||
logger.error("Error clearing local cache for type " + cache, e);
|
||||
log.error("Error clearing local cache for type " + cache, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2222,7 +2203,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
if (t != null) {
|
||||
return new ObtainedTransaction((SpiTransaction) t);
|
||||
}
|
||||
SpiTransaction trans = transactionManager.getActive();
|
||||
SpiTransaction trans = transactionManager.active();
|
||||
if (trans != null) {
|
||||
return new ObtainedTransaction(trans);
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ final class InitDataSource {
|
||||
* Attach DataSourceAlert via service loader if present.
|
||||
*/
|
||||
private void attachAlert(DataSourceConfig dsConfig) {
|
||||
DataSourceAlertFactory alertFactory = config.service(DataSourceAlertFactory.class);
|
||||
DataSourceAlertFactory alertFactory = ServiceUtil.service(DataSourceAlertFactory.class);
|
||||
if (alertFactory != null) {
|
||||
dsConfig.setAlert(alertFactory.createAlert());
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package io.ebeaninternal.server.core;
|
||||
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.server.dto.DtoNamedQueries;
|
||||
import io.ebeaninternal.xmapping.api.XmapDto;
|
||||
import io.ebeaninternal.xmapping.api.XmapEbean;
|
||||
import io.ebeaninternal.xmapping.api.XmapRawSql;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -16,8 +15,6 @@ import java.util.Map;
|
||||
*/
|
||||
final class InternalConfigXmlMap {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(InternalConfigXmlMap.class);
|
||||
|
||||
private final List<XmapEbean> xmlEbeanList;
|
||||
private final ClassLoader classLoader;
|
||||
private final Map<Class<?>, DtoNamedQueries> dtoNamedQueries = new HashMap<>();
|
||||
@@ -58,7 +55,7 @@ final class InternalConfigXmlMap {
|
||||
try {
|
||||
dtoClass = Class.forName(dto.getClazz(), false, classLoader);
|
||||
} catch (Exception e) {
|
||||
log.error("Could not load dto bean class " + dto.getClazz() + " for ebean xml entry");
|
||||
CoreLog.internal.error("Could not load dto bean class " + dto.getClazz() + " for ebean xml entry");
|
||||
return;
|
||||
}
|
||||
DtoNamedQueries namedQueries = dtoNamedQueries.computeIfAbsent(dtoClass, aClass -> new DtoNamedQueries());
|
||||
|
||||
@@ -3,12 +3,7 @@ package io.ebeaninternal.server.core;
|
||||
import com.fasterxml.jackson.core.JsonFactory;
|
||||
import io.ebean.ExpressionFactory;
|
||||
import io.ebean.annotation.Platform;
|
||||
import io.ebean.cache.ServerCacheFactory;
|
||||
import io.ebean.cache.ServerCacheManager;
|
||||
import io.ebean.cache.ServerCacheNotify;
|
||||
import io.ebean.cache.ServerCacheNotifyPlugin;
|
||||
import io.ebean.cache.ServerCacheOptions;
|
||||
import io.ebean.cache.ServerCachePlugin;
|
||||
import io.ebean.cache.*;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.config.ExternalTransactionManager;
|
||||
import io.ebean.config.ProfilingConfig;
|
||||
@@ -22,36 +17,17 @@ import io.ebean.event.readaudit.ReadAuditLogger;
|
||||
import io.ebean.event.readaudit.ReadAuditPrepare;
|
||||
import io.ebean.plugin.Plugin;
|
||||
import io.ebean.plugin.SpiServer;
|
||||
import io.ebeaninternal.api.DbOffline;
|
||||
import io.ebeaninternal.api.ExtraMetrics;
|
||||
import io.ebeaninternal.api.QueryPlanManager;
|
||||
import io.ebeaninternal.api.SpiBackgroundExecutor;
|
||||
import io.ebeaninternal.api.SpiDdlGenerator;
|
||||
import io.ebeaninternal.api.SpiDdlGeneratorProvider;
|
||||
import io.ebeaninternal.api.SpiEbeanServer;
|
||||
import io.ebeaninternal.api.SpiJsonContext;
|
||||
import io.ebeaninternal.api.SpiLogManager;
|
||||
import io.ebeaninternal.api.SpiLogger;
|
||||
import io.ebeaninternal.api.SpiLoggerFactory;
|
||||
import io.ebeaninternal.api.SpiProfileHandler;
|
||||
import io.ebeaninternal.api.*;
|
||||
import io.ebeaninternal.server.autotune.AutoTuneService;
|
||||
import io.ebeaninternal.server.autotune.AutoTuneServiceProvider;
|
||||
import io.ebeaninternal.server.autotune.NoAutoTuneService;
|
||||
import io.ebeaninternal.server.cache.CacheManagerOptions;
|
||||
import io.ebeaninternal.server.cache.DefaultCacheAdapter;
|
||||
import io.ebeaninternal.server.cache.DefaultServerCacheManager;
|
||||
import io.ebeaninternal.server.cache.DefaultServerCachePlugin;
|
||||
import io.ebeaninternal.server.cache.SpiCacheManager;
|
||||
import io.ebeaninternal.server.cache.*;
|
||||
import io.ebeaninternal.server.changelog.DefaultChangeLogListener;
|
||||
import io.ebeaninternal.server.changelog.DefaultChangeLogPrepare;
|
||||
import io.ebeaninternal.server.changelog.DefaultChangeLogRegister;
|
||||
import io.ebeaninternal.server.cluster.ClusterManager;
|
||||
import io.ebeaninternal.server.core.bootup.BootupClasses;
|
||||
import io.ebeaninternal.server.core.timezone.DataTimeZone;
|
||||
import io.ebeaninternal.server.core.timezone.MySqlDataTimeZone;
|
||||
import io.ebeaninternal.server.core.timezone.NoDataTimeZone;
|
||||
import io.ebeaninternal.server.core.timezone.OracleDataTimeZone;
|
||||
import io.ebeaninternal.server.core.timezone.SimpleDataTimeZone;
|
||||
import io.ebeaninternal.server.core.timezone.*;
|
||||
import io.ebeaninternal.server.deploy.BeanDescriptorManager;
|
||||
import io.ebeaninternal.server.deploy.generatedproperty.GeneratedPropertyFactory;
|
||||
import io.ebeaninternal.server.deploy.parse.DeployCreateProperties;
|
||||
@@ -67,30 +43,11 @@ import io.ebeaninternal.server.persist.Binder;
|
||||
import io.ebeaninternal.server.persist.DefaultPersister;
|
||||
import io.ebeaninternal.server.persist.platform.MultiValueBind;
|
||||
import io.ebeaninternal.server.persist.platform.PostgresMultiValueBind;
|
||||
import io.ebeaninternal.server.query.CQueryEngine;
|
||||
import io.ebeaninternal.server.query.CQueryPlanManager;
|
||||
import io.ebeaninternal.server.query.DefaultOrmQueryEngine;
|
||||
import io.ebeaninternal.server.query.DefaultRelationalQueryEngine;
|
||||
import io.ebeaninternal.server.query.DtoQueryEngine;
|
||||
import io.ebeaninternal.server.query.QueryPlanLogger;
|
||||
import io.ebeaninternal.server.query.QueryPlanLoggerExplain;
|
||||
import io.ebeaninternal.server.query.QueryPlanLoggerOracle;
|
||||
import io.ebeaninternal.server.query.QueryPlanLoggerPostgres;
|
||||
import io.ebeaninternal.server.query.QueryPlanLoggerSqlServer;
|
||||
import io.ebeaninternal.server.query.*;
|
||||
import io.ebeaninternal.server.readaudit.DefaultReadAuditLogger;
|
||||
import io.ebeaninternal.server.readaudit.DefaultReadAuditPrepare;
|
||||
import io.ebeaninternal.server.text.json.DJsonContext;
|
||||
import io.ebeaninternal.server.transaction.DataSourceSupplier;
|
||||
import io.ebeaninternal.server.transaction.DefaultProfileHandler;
|
||||
import io.ebeaninternal.server.transaction.DefaultTransactionScopeManager;
|
||||
import io.ebeaninternal.server.transaction.DocStoreTransactionManager;
|
||||
import io.ebeaninternal.server.transaction.ExternalTransactionScopeManager;
|
||||
import io.ebeaninternal.server.transaction.JtaTransactionManager;
|
||||
import io.ebeaninternal.server.transaction.NoopProfileHandler;
|
||||
import io.ebeaninternal.server.transaction.TableModState;
|
||||
import io.ebeaninternal.server.transaction.TransactionManager;
|
||||
import io.ebeaninternal.server.transaction.TransactionManagerOptions;
|
||||
import io.ebeaninternal.server.transaction.TransactionScopeManager;
|
||||
import io.ebeaninternal.server.transaction.*;
|
||||
import io.ebeaninternal.server.type.DefaultTypeManager;
|
||||
import io.ebeaninternal.server.type.TypeManager;
|
||||
import io.ebeaninternal.xmapping.api.XmapEbean;
|
||||
@@ -100,14 +57,8 @@ import io.ebeanservice.docstore.api.DocStoreIntegration;
|
||||
import io.ebeanservice.docstore.api.DocStoreUpdateProcessor;
|
||||
import io.ebeanservice.docstore.none.NoneDocStoreFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Used to extend the DatabaseConfig with additional objects used to configure and
|
||||
@@ -115,7 +66,7 @@ import java.util.ServiceLoader;
|
||||
*/
|
||||
public final class InternalConfiguration {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(InternalConfiguration.class);
|
||||
private static final Logger log = CoreLog.internal;
|
||||
|
||||
private final TableModState tableModState;
|
||||
private final boolean online;
|
||||
@@ -156,7 +107,7 @@ public final class InternalConfiguration {
|
||||
this.clockService = new ClockService(config.getClock());
|
||||
this.tableModState = new TableModState();
|
||||
this.logManager = initLogManager();
|
||||
this.docStoreFactory = initDocStoreFactory(config.service(DocStoreFactory.class));
|
||||
this.docStoreFactory = initDocStoreFactory(service(DocStoreFactory.class));
|
||||
this.jsonFactory = config.getJsonFactory();
|
||||
this.clusterManager = clusterManager;
|
||||
this.backgroundExecutor = backgroundExecutor;
|
||||
@@ -191,8 +142,12 @@ public final class InternalConfiguration {
|
||||
return new InternalConfigXmlMap(xmEbeans, config.getClassLoadConfig().getClassLoader());
|
||||
}
|
||||
|
||||
private <S> S service(Class<S> cls) {
|
||||
return ServiceUtil.service(cls);
|
||||
}
|
||||
|
||||
private List<XmapEbean> readExternalMapping() {
|
||||
final XmapService xmapService = config.service(XmapService.class);
|
||||
final XmapService xmapService = service(XmapService.class);
|
||||
if (xmapService == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@@ -201,7 +156,7 @@ public final class InternalConfiguration {
|
||||
|
||||
private SpiLogManager initLogManager() {
|
||||
// allow plugin - i.e. capture executed SQL for testing/asserts
|
||||
SpiLoggerFactory loggerFactory = config.service(SpiLoggerFactory.class);
|
||||
SpiLoggerFactory loggerFactory = service(SpiLoggerFactory.class);
|
||||
if (loggerFactory == null) {
|
||||
loggerFactory = new DLoggerFactory();
|
||||
}
|
||||
@@ -336,7 +291,7 @@ public final class InternalConfiguration {
|
||||
}
|
||||
|
||||
AutoTuneService createAutoTuneService(SpiEbeanServer server) {
|
||||
final AutoTuneServiceProvider provider = config.service(AutoTuneServiceProvider.class);
|
||||
final AutoTuneServiceProvider provider = service(AutoTuneServiceProvider.class);
|
||||
return provider == null ? new NoAutoTuneService() : provider.create(server, config);
|
||||
}
|
||||
|
||||
@@ -445,7 +400,7 @@ public final class InternalConfiguration {
|
||||
if (!profilingConfig.isEnabled()) {
|
||||
return new NoopProfileHandler();
|
||||
}
|
||||
SpiProfileHandler handler = config.service(SpiProfileHandler.class);
|
||||
SpiProfileHandler handler = service(SpiProfileHandler.class);
|
||||
if (handler == null) {
|
||||
handler = new DefaultProfileHandler(profilingConfig);
|
||||
}
|
||||
@@ -478,7 +433,7 @@ public final class InternalConfiguration {
|
||||
externalTransactionManager = new JtaTransactionManager();
|
||||
}
|
||||
if (externalTransactionManager != null) {
|
||||
logger.info("Using Transaction Manager [" + externalTransactionManager.getClass() + "]");
|
||||
log.info("Using Transaction Manager [" + externalTransactionManager.getClass() + "]");
|
||||
return new ExternalTransactionScopeManager(externalTransactionManager);
|
||||
} else {
|
||||
return new DefaultTransactionScopeManager();
|
||||
@@ -533,7 +488,7 @@ public final class InternalConfiguration {
|
||||
}
|
||||
SlowQueryListener listener = config.getSlowQueryListener();
|
||||
if (listener == null) {
|
||||
listener = config.service(SlowQueryListener.class);
|
||||
listener = service(SlowQueryListener.class);
|
||||
if (listener == null) {
|
||||
listener = new DefaultSlowQueryListener();
|
||||
}
|
||||
@@ -568,7 +523,7 @@ public final class InternalConfiguration {
|
||||
if (iterator.hasNext()) {
|
||||
// use the cacheFactory (via classpath service loader)
|
||||
plugin = iterator.next();
|
||||
logger.debug("using ServerCacheFactory {}", plugin.getClass());
|
||||
log.debug("using ServerCacheFactory {}", plugin.getClass());
|
||||
} else {
|
||||
// use the built in default l2 caching which is local cache based
|
||||
localL2Caching = true;
|
||||
@@ -589,7 +544,7 @@ public final class InternalConfiguration {
|
||||
}
|
||||
|
||||
ServerCacheFactory factory = serverCachePlugin.create(config, backgroundExecutor);
|
||||
ServerCacheNotifyPlugin notifyPlugin = config.service(ServerCacheNotifyPlugin.class);
|
||||
ServerCacheNotifyPlugin notifyPlugin = service(ServerCacheNotifyPlugin.class);
|
||||
if (notifyPlugin != null) {
|
||||
// plugin supplied so use that to send notifications
|
||||
cacheNotify = notifyPlugin.create(config);
|
||||
@@ -644,14 +599,21 @@ public final class InternalConfiguration {
|
||||
* Return the DDL generator.
|
||||
*/
|
||||
public SpiDdlGenerator initDdlGenerator(SpiEbeanServer server) {
|
||||
final SpiDdlGeneratorProvider service = config.service(SpiDdlGeneratorProvider.class);
|
||||
return service == null ? new NoopDdl() : service.generator(server);
|
||||
final SpiDdlGeneratorProvider service = service(SpiDdlGeneratorProvider.class);
|
||||
return service == null ? new NoopDdl(server.config().isDdlRun()) : service.generator(server);
|
||||
}
|
||||
|
||||
private static class NoopDdl implements SpiDdlGenerator {
|
||||
private final boolean ddlRun;
|
||||
NoopDdl(boolean ddlRun) {
|
||||
this.ddlRun = ddlRun;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(boolean online) {
|
||||
// do nothing
|
||||
if (online && ddlRun) {
|
||||
CoreLog.log.error("Configured to run DDL but ebean-ddl-generator is not in the classpath (or ebean-test in the test classpath?)");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
package io.ebeaninternal.server.core;
|
||||
|
||||
import io.ebean.CacheMode;
|
||||
import io.ebean.CancelableQuery;
|
||||
import io.ebean.OrderBy;
|
||||
import io.ebean.PersistenceContextScope;
|
||||
import io.ebean.QueryIterator;
|
||||
import io.ebean.Version;
|
||||
import io.ebean.*;
|
||||
import io.ebean.bean.BeanCollection;
|
||||
import io.ebean.bean.EntityBean;
|
||||
import io.ebean.bean.PersistenceContext;
|
||||
@@ -16,39 +11,17 @@ import io.ebean.common.CopyOnFirstWriteList;
|
||||
import io.ebean.event.BeanFindController;
|
||||
import io.ebean.event.BeanQueryAdapter;
|
||||
import io.ebean.text.json.JsonReadOptions;
|
||||
import io.ebeaninternal.api.BeanCacheResult;
|
||||
import io.ebeaninternal.api.CQueryPlanKey;
|
||||
import io.ebeaninternal.api.CacheIdLookup;
|
||||
import io.ebeaninternal.api.HashQuery;
|
||||
import io.ebeaninternal.api.LoadContext;
|
||||
import io.ebeaninternal.api.NaturalKeyQueryData;
|
||||
import io.ebeaninternal.api.NaturalKeySet;
|
||||
import io.ebeaninternal.api.SpiEbeanServer;
|
||||
import io.ebeaninternal.api.SpiQuery;
|
||||
import io.ebeaninternal.api.*;
|
||||
import io.ebeaninternal.api.SpiQuery.Type;
|
||||
import io.ebeaninternal.api.SpiQuerySecondary;
|
||||
import io.ebeaninternal.api.SpiTransaction;
|
||||
import io.ebeaninternal.server.deploy.BeanDescriptor;
|
||||
import io.ebeaninternal.server.deploy.BeanProperty;
|
||||
import io.ebeaninternal.server.deploy.BeanPropertyAssocMany;
|
||||
import io.ebeaninternal.server.deploy.DeployParser;
|
||||
import io.ebeaninternal.server.deploy.DeployPropertyParserMap;
|
||||
import io.ebeaninternal.server.deploy.*;
|
||||
import io.ebeaninternal.server.el.ElPropertyValue;
|
||||
import io.ebeaninternal.server.loadcontext.DLoadContext;
|
||||
import io.ebeaninternal.server.query.CQueryPlan;
|
||||
import io.ebeaninternal.server.transaction.DefaultPersistenceContext;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
@@ -57,8 +30,6 @@ import java.util.function.Predicate;
|
||||
*/
|
||||
public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQueryRequest<T> {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(OrmQueryRequest.class);
|
||||
|
||||
private final BeanDescriptor<T> beanDescriptor;
|
||||
private final OrmQueryEngine queryEngine;
|
||||
private final SpiQuery<T> query;
|
||||
@@ -230,14 +201,6 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
|
||||
return persistenceContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the bean to the persistence context.
|
||||
*/
|
||||
public void persistenceContextAdd(EntityBean bean) {
|
||||
Object id = beanDescriptor.getId(bean);
|
||||
beanDescriptor.contextPut(persistenceContext, id, bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* This will create a local (readOnly) transaction if no current transaction
|
||||
* exists.
|
||||
@@ -277,7 +240,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
|
||||
// Just log this and carry on. A previous exception has been
|
||||
// thrown and if this rollback throws exception it likely means
|
||||
// that the connection is broken (and the dataSource and db will cleanup)
|
||||
log.error("Error trying to rollback a transaction (after a prior exception thrown)", e);
|
||||
CoreLog.log.error("Error trying to rollback a transaction (after a prior exception thrown)", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package io.ebeaninternal.server.core;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
public final class ServiceUtil {
|
||||
|
||||
public static <S> S service(Class<S> cls) {
|
||||
ServiceLoader<S> load = ServiceLoader.load(cls);
|
||||
Iterator<S> serviceInstances = load.iterator();
|
||||
return serviceInstances.hasNext() ? serviceInstances.next() : null;
|
||||
}
|
||||
}
|
||||
+3
-4
@@ -2,9 +2,9 @@ package io.ebeaninternal.server.core.bootup;
|
||||
|
||||
import io.avaje.classpath.scanner.ClassPathScanner;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.server.core.ClassPathScanners;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -14,10 +14,9 @@ import java.util.Set;
|
||||
*/
|
||||
public class BootupClassPathSearch {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(BootupClassPathSearch.class);
|
||||
private static final Logger log = CoreLog.internal;
|
||||
|
||||
private final List<String> packages;
|
||||
|
||||
private final List<ClassPathScanner> scanners;
|
||||
|
||||
/**
|
||||
@@ -60,7 +59,7 @@ public class BootupClassPathSearch {
|
||||
}
|
||||
|
||||
long searchTime = System.currentTimeMillis() - st;
|
||||
logger.debug("Classpath search entities[{}] searchTime[{}] in packages[{}]", bc.getEntities().size(), searchTime, packages);
|
||||
log.debug("Classpath search entities[{}] searchTime[{}] in packages[{}]", bc.getEntities().size(), searchTime, packages);
|
||||
return bc;
|
||||
|
||||
} catch (Exception ex) {
|
||||
|
||||
@@ -5,21 +5,15 @@ import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.config.IdGenerator;
|
||||
import io.ebean.config.ScalarTypeConverter;
|
||||
import io.ebean.core.type.ScalarType;
|
||||
import io.ebean.event.BeanFindController;
|
||||
import io.ebean.event.BeanPersistController;
|
||||
import io.ebean.event.BeanPersistListener;
|
||||
import io.ebean.event.BeanPostConstructListener;
|
||||
import io.ebean.event.BeanPostLoad;
|
||||
import io.ebean.event.BeanQueryAdapter;
|
||||
import io.ebean.event.ServerConfigStartup;
|
||||
import io.ebean.event.*;
|
||||
import io.ebean.event.changelog.ChangeLogListener;
|
||||
import io.ebean.event.changelog.ChangeLogPrepare;
|
||||
import io.ebean.event.changelog.ChangeLogRegister;
|
||||
import io.ebean.event.readaudit.ReadAuditLogger;
|
||||
import io.ebean.event.readaudit.ReadAuditPrepare;
|
||||
import io.ebean.util.AnnotationUtil;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.persistence.AttributeConverter;
|
||||
import javax.persistence.Embeddable;
|
||||
@@ -37,7 +31,7 @@ import java.util.function.Predicate;
|
||||
*/
|
||||
public class BootupClasses implements Predicate<Class<?>> {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(BootupClasses.class);
|
||||
private static final Logger log = CoreLog.internal;
|
||||
|
||||
private final List<Class<?>> embeddableList = new ArrayList<>();
|
||||
private final List<Class<?>> entityList = new ArrayList<>();
|
||||
@@ -211,13 +205,13 @@ public class BootupClasses implements Predicate<Class<?>> {
|
||||
try {
|
||||
return cls.getConstructor().newInstance();
|
||||
} catch (NoSuchMethodException e) {
|
||||
logger.debug("Ignore/expected - no default constructor: " +e.getMessage());
|
||||
log.debug("Ignore/expected - no default constructor: " +e.getMessage());
|
||||
return null;
|
||||
|
||||
} catch (Exception e) {
|
||||
if (logOnException) {
|
||||
// not expected but we log and carry on
|
||||
logger.error("Error creating " + cls, e);
|
||||
log.error("Error creating " + cls, e);
|
||||
return null;
|
||||
|
||||
} else {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package io.ebeaninternal.server.core.bootup;
|
||||
|
||||
import io.ebean.util.StringHelper;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.util.UrlHelper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -20,10 +20,9 @@ import java.util.jar.Manifest;
|
||||
*/
|
||||
class ManifestReader {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ManifestReader.class);
|
||||
private static final Logger log = CoreLog.internal;
|
||||
|
||||
private final Set<String> packageSet = new HashSet<>();
|
||||
|
||||
private final ClassLoader classLoader;
|
||||
|
||||
/**
|
||||
@@ -65,7 +64,7 @@ class ManifestReader {
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
logger.warn("Error reading " + resourcePath + " manifest resources", e);
|
||||
log.warn("Error reading " + resourcePath + " manifest resources", e);
|
||||
}
|
||||
return packageSet;
|
||||
}
|
||||
|
||||
@@ -1,16 +1,8 @@
|
||||
package io.ebeaninternal.server.deploy;
|
||||
|
||||
import io.ebean.PersistenceContextScope;
|
||||
import io.ebean.Query;
|
||||
import io.ebean.SqlUpdate;
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.ValuePair;
|
||||
import io.ebean.*;
|
||||
import io.ebean.annotation.DocStoreMode;
|
||||
import io.ebean.bean.BeanCollection;
|
||||
import io.ebean.bean.EntityBean;
|
||||
import io.ebean.bean.EntityBeanIntercept;
|
||||
import io.ebean.bean.PersistenceContext;
|
||||
import io.ebean.bean.SingleBeanLoader;
|
||||
import io.ebean.bean.*;
|
||||
import io.ebean.cache.QueryCacheEntry;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.config.EncryptKey;
|
||||
@@ -18,12 +10,7 @@ import io.ebean.config.dbplatform.IdType;
|
||||
import io.ebean.config.dbplatform.PlatformIdGenerator;
|
||||
import io.ebean.core.type.DocPropertyType;
|
||||
import io.ebean.core.type.ScalarType;
|
||||
import io.ebean.event.BeanFindController;
|
||||
import io.ebean.event.BeanPersistController;
|
||||
import io.ebean.event.BeanPersistListener;
|
||||
import io.ebean.event.BeanPostConstructListener;
|
||||
import io.ebean.event.BeanPostLoad;
|
||||
import io.ebean.event.BeanQueryAdapter;
|
||||
import io.ebean.event.*;
|
||||
import io.ebean.event.changelog.BeanChange;
|
||||
import io.ebean.event.changelog.ChangeLogFilter;
|
||||
import io.ebean.event.changelog.ChangeType;
|
||||
@@ -45,32 +32,15 @@ import io.ebeaninternal.api.json.SpiJsonWriter;
|
||||
import io.ebeaninternal.server.cache.CacheChangeSet;
|
||||
import io.ebeaninternal.server.cache.CachedBeanData;
|
||||
import io.ebeaninternal.server.cache.CachedManyIds;
|
||||
import io.ebeaninternal.server.core.CacheOptions;
|
||||
import io.ebeaninternal.server.core.DefaultSqlUpdate;
|
||||
import io.ebeaninternal.server.core.InternString;
|
||||
import io.ebeaninternal.server.core.PersistRequest;
|
||||
import io.ebeaninternal.server.core.PersistRequestBean;
|
||||
import io.ebeaninternal.server.core.*;
|
||||
import io.ebeaninternal.server.deploy.id.IdBinder;
|
||||
import io.ebeaninternal.server.deploy.id.IdBinderSimple;
|
||||
import io.ebeaninternal.server.deploy.id.ImportedId;
|
||||
import io.ebeaninternal.server.deploy.meta.DeployBeanDescriptor;
|
||||
import io.ebeaninternal.server.deploy.meta.DeployBeanPropertyLists;
|
||||
import io.ebeaninternal.server.el.ElComparator;
|
||||
import io.ebeaninternal.server.el.ElComparatorCompound;
|
||||
import io.ebeaninternal.server.el.ElComparatorNoop;
|
||||
import io.ebeaninternal.server.el.ElComparatorProperty;
|
||||
import io.ebeaninternal.server.el.ElPropertyChainBuilder;
|
||||
import io.ebeaninternal.server.el.ElPropertyDeploy;
|
||||
import io.ebeaninternal.server.el.ElPropertyValue;
|
||||
import io.ebeaninternal.server.el.*;
|
||||
import io.ebeaninternal.server.persist.DeleteMode;
|
||||
import io.ebeaninternal.server.query.CQueryPlan;
|
||||
import io.ebeaninternal.server.query.ExtraJoin;
|
||||
import io.ebeaninternal.server.query.STreeProperty;
|
||||
import io.ebeaninternal.server.query.STreePropertyAssoc;
|
||||
import io.ebeaninternal.server.query.STreePropertyAssocMany;
|
||||
import io.ebeaninternal.server.query.STreePropertyAssocOne;
|
||||
import io.ebeaninternal.server.query.STreeType;
|
||||
import io.ebeaninternal.server.query.SqlBeanLoad;
|
||||
import io.ebeaninternal.server.query.*;
|
||||
import io.ebeaninternal.server.querydefn.DefaultOrmQuery;
|
||||
import io.ebeaninternal.server.querydefn.OrmQueryDetail;
|
||||
import io.ebeaninternal.server.querydefn.OrmQueryProperties;
|
||||
@@ -85,7 +55,6 @@ import io.ebeanservice.docstore.api.mapping.DocMappingBuilder;
|
||||
import io.ebeanservice.docstore.api.mapping.DocPropertyMapping;
|
||||
import io.ebeanservice.docstore.api.mapping.DocumentMapping;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.persistence.PersistenceException;
|
||||
@@ -94,14 +63,7 @@ import java.io.StringWriter;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -113,7 +75,7 @@ import static io.ebeaninternal.server.persist.DmlUtil.isNullOrZero;
|
||||
*/
|
||||
public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(BeanDescriptor.class);
|
||||
private static final Logger log = CoreLog.internal;
|
||||
|
||||
public enum EntityType {
|
||||
ORM, EMBEDDED, VIEW, SQL, DOC
|
||||
@@ -511,8 +473,8 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
* as they are used to get the imported and exported properties.
|
||||
*/
|
||||
void initialiseId(BeanDescriptorInitContext initContext) {
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("BeanDescriptor initialise " + fullName);
|
||||
if (log.isTraceEnabled()) {
|
||||
log.trace("BeanDescriptor initialise " + fullName);
|
||||
}
|
||||
if (draftable) {
|
||||
initContext.addDraft(baseTable, draftTable);
|
||||
@@ -812,7 +774,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
changeJson.flush();
|
||||
return beanChange(ChangeType.UPDATE, request.beanId(), changeJson.newJson(), changeJson.oldJson());
|
||||
} catch (RuntimeException e) {
|
||||
logger.error("Failed to write ChangeLog entry for update", e);
|
||||
log.error("Failed to write ChangeLog entry for update", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -828,7 +790,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
jsonWriter.flush();
|
||||
return beanChange(ChangeType.INSERT, request.beanId(), writer.toString(), null);
|
||||
} catch (IOException e) {
|
||||
logger.error("Failed to write ChangeLog entry for insert", e);
|
||||
log.error("Failed to write ChangeLog entry for insert", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -2303,11 +2265,11 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
private ElComparator<T> createPropertyComparator(SortByClause.Property sortProp) {
|
||||
ElPropertyValue elGetValue = elGetValue(sortProp.getName());
|
||||
if (elGetValue == null) {
|
||||
logger.error("Sort property [" + sortProp + "] not found in " + beanType + ". Cannot sort.");
|
||||
log.error("Sort property [" + sortProp + "] not found in " + beanType + ". Cannot sort.");
|
||||
return new ElComparatorNoop<>();
|
||||
}
|
||||
if (elGetValue.isAssocMany()) {
|
||||
logger.error("Sort property [" + sortProp + "] in " + beanType + " is a many-property. Cannot sort.");
|
||||
log.error("Sort property [" + sortProp + "] in " + beanType + " is a many-property. Cannot sort.");
|
||||
return new ElComparatorNoop<>();
|
||||
}
|
||||
Boolean nullsHigh = sortProp.getNullsHigh();
|
||||
@@ -2776,7 +2738,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
public void markAsDeleted(EntityBean bean) {
|
||||
if (softDeleteProperty == null) {
|
||||
Object id = getId(bean);
|
||||
logger.info("(Lazy) loading unsuccessful for type:{} id:{} - expecting when bean has been deleted", name(), id);
|
||||
log.info("(Lazy) loading unsuccessful for type:{} id:{} - expecting when bean has been deleted", name(), id);
|
||||
bean._ebean_getIntercept().setLazyLoadFailure(id);
|
||||
} else {
|
||||
softDeleteValue(bean);
|
||||
@@ -2875,8 +2837,8 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
final EntityBeanIntercept ebi = bean._ebean_getIntercept();
|
||||
for (BeanPropertyAssocMany<?> many : propertiesManySave) {
|
||||
if (ebi.isLoadedProperty(many.propertyIndex())) {
|
||||
final BeanCollection<?> value = (BeanCollection<?>) many.getValue(bean);
|
||||
if (value != null && value.hasModifications()) {
|
||||
final Object value = many.getValue(bean);
|
||||
if (value instanceof BeanCollection && ((BeanCollection<?>)value).hasModifications() || value != null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+10
-25
@@ -6,17 +6,9 @@ import io.ebean.bean.EntityBeanIntercept;
|
||||
import io.ebean.bean.PersistenceContext;
|
||||
import io.ebean.cache.QueryCacheEntry;
|
||||
import io.ebean.cache.ServerCache;
|
||||
import io.ebeaninternal.api.BeanCacheResult;
|
||||
import io.ebeaninternal.api.SpiCacheControl;
|
||||
import io.ebeaninternal.api.SpiCacheRegion;
|
||||
import io.ebeaninternal.api.SpiTransaction;
|
||||
import io.ebeaninternal.api.*;
|
||||
import io.ebeaninternal.api.TransactionEventTable.TableIUD;
|
||||
import io.ebeaninternal.server.cache.CacheChangeSet;
|
||||
import io.ebeaninternal.server.cache.CachedBeanData;
|
||||
import io.ebeaninternal.server.cache.CachedBeanDataFromBean;
|
||||
import io.ebeaninternal.server.cache.CachedBeanDataToBean;
|
||||
import io.ebeaninternal.server.cache.CachedManyIds;
|
||||
import io.ebeaninternal.server.cache.SpiCacheManager;
|
||||
import io.ebeaninternal.server.cache.*;
|
||||
import io.ebeaninternal.server.core.CacheOptions;
|
||||
import io.ebeaninternal.server.core.PersistRequest;
|
||||
import io.ebeaninternal.server.core.PersistRequestBean;
|
||||
@@ -25,15 +17,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Helper for BeanDescriptor that manages the bean, query and collection caches.
|
||||
@@ -42,7 +26,7 @@ import java.util.Set;
|
||||
*/
|
||||
final class BeanDescriptorCacheHelp<T> {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(BeanDescriptorCacheHelp.class);
|
||||
private static final Logger log = CoreLog.internal;
|
||||
|
||||
private static final Logger queryLog = LoggerFactory.getLogger("io.ebean.cache.QUERY");
|
||||
private static final Logger beanLog = LoggerFactory.getLogger("io.ebean.cache.BEAN");
|
||||
@@ -120,10 +104,10 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
void deriveNotifyFlags() {
|
||||
cacheNotifyOnAll = (invalidateQueryCache || beanCache != null || queryCache != null);
|
||||
cacheNotifyOnDelete = !cacheNotifyOnAll && isNotifyOnDeletes();
|
||||
if (logger.isDebugEnabled()) {
|
||||
if (log.isDebugEnabled()) {
|
||||
if (cacheNotifyOnAll || cacheNotifyOnDelete) {
|
||||
String notifyMode = cacheNotifyOnAll ? "All" : "Delete";
|
||||
logger.debug("l2 caching on {} - beanCaching:{} queryCaching:{} notifyMode:{} ",
|
||||
log.debug("l2 caching on {} - beanCaching:{} queryCaching:{} notifyMode:{} ",
|
||||
desc.fullName(), isBeanCaching(), isQueryCaching(), notifyMode);
|
||||
}
|
||||
}
|
||||
@@ -324,7 +308,7 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
}
|
||||
beanCache.put(parentId, newData);
|
||||
} catch (IOException e) {
|
||||
logger.error("Error updating L2 cache", e);
|
||||
log.error("Error updating L2 cache", e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -365,12 +349,13 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
for (Object id : ids) {
|
||||
keys.add(desc.cacheKey(id));
|
||||
}
|
||||
|
||||
if (ids.isEmpty()) {
|
||||
return new BeanCacheResult<>();
|
||||
}
|
||||
Map<Object, Object> beanDataMap = beanCache.getAll(keys);
|
||||
if (beanLog.isTraceEnabled()) {
|
||||
beanLog.trace(" MGET {}({}) - hits:{}", cacheName, ids, beanDataMap.keySet());
|
||||
}
|
||||
|
||||
BeanCacheResult<T> result = new BeanCacheResult<>();
|
||||
for (Map.Entry<Object, Object> entry : beanDataMap.entrySet()) {
|
||||
CachedBeanData cachedBeanData = (CachedBeanData) entry.getValue();
|
||||
|
||||
@@ -42,7 +42,6 @@ import io.ebeaninternal.xmapping.api.XmapRawSql;
|
||||
import io.ebeanservice.docstore.api.DocStoreBeanAdapter;
|
||||
import io.ebeanservice.docstore.api.DocStoreFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.persistence.MappedSuperclass;
|
||||
import javax.persistence.PersistenceException;
|
||||
@@ -59,7 +58,7 @@ import java.util.concurrent.TimeUnit;
|
||||
*/
|
||||
public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTypeManager {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(BeanDescriptorManager.class);
|
||||
private static final Logger log = CoreLog.internal;
|
||||
|
||||
private static final BeanDescComparator beanDescComparator = new BeanDescComparator();
|
||||
public static final String JAVA_LANG_RECORD = "java.lang.Record";
|
||||
@@ -310,7 +309,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
} catch (BeanNotEnhancedException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
logger.error("Error in deployment", e);
|
||||
log.error("Error in deployment", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@@ -333,13 +332,13 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
try {
|
||||
entityClass = Class.forName(entityClassName, false, classLoader);
|
||||
} catch (Exception e) {
|
||||
logger.error("Could not load entity bean class " + entityClassName + " for ebean.xml entry");
|
||||
log.error("Could not load entity bean class " + entityClassName + " for ebean.xml entry");
|
||||
return;
|
||||
}
|
||||
|
||||
DeployBeanInfo<?> info = deployInfoMap.get(entityClass);
|
||||
if (info == null) {
|
||||
logger.error("No entity bean for ebean.xml entry " + entityClassName);
|
||||
log.error("No entity bean for ebean.xml entry " + entityClassName);
|
||||
|
||||
} else {
|
||||
for (XmapRawSql sql : entityDeploy.getRawSql()) {
|
||||
@@ -580,11 +579,11 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
int pc = postConstructManager.getRegisterCount();
|
||||
int lc = persistListenerManager.getRegisterCount();
|
||||
int fc = beanFinderManager.getRegisterCount();
|
||||
logger.debug("BeanPersistControllers[{}] BeanFinders[{}] BeanPersistListeners[{}] BeanQueryAdapters[{}] BeanPostLoaders[{}] BeanPostConstructors[{}]", cc, fc, lc, qa, pl, pc);
|
||||
log.debug("BeanPersistControllers[{}] BeanFinders[{}] BeanPersistListeners[{}] BeanQueryAdapters[{}] BeanPostLoaders[{}] BeanPostConstructors[{}]", cc, fc, lc, qa, pl, pc);
|
||||
}
|
||||
|
||||
private void logStatus() {
|
||||
logger.debug("Entities[{}]", entityBeanCount);
|
||||
log.debug("Entities[{}]", entityBeanCount);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -850,7 +849,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
|
||||
String m = "Implicitly found mappedBy for " + targetDesc + "." + prop;
|
||||
m += " by searching for [" + searchName + "] against " + matchSet;
|
||||
logger.debug(m);
|
||||
log.debug(m);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1209,12 +1208,12 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
final DeployIdentityMode identityMode = desc.getIdentityMode();
|
||||
if (identityMode.isSequence() && !dbIdentity.isSupportsSequence()) {
|
||||
// explicit sequence but not supported by the DatabasePlatform
|
||||
logger.info("Explicit sequence on " + desc.getFullName() + " but not supported by DB Platform - ignored");
|
||||
log.info("Explicit sequence on " + desc.getFullName() + " but not supported by DB Platform - ignored");
|
||||
identityMode.setIdType(IdType.AUTO);
|
||||
}
|
||||
if (identityMode.isIdentity() && !dbIdentity.isSupportsIdentity()) {
|
||||
// explicit identity but not supported by the DatabasePlatform
|
||||
logger.info("Explicit Identity on " + desc.getFullName() + " but not supported by DB Platform - ignored");
|
||||
log.info("Explicit Identity on " + desc.getFullName() + " but not supported by DB Platform - ignored");
|
||||
identityMode.setIdType(IdType.AUTO);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package io.ebeaninternal.server.deploy;
|
||||
|
||||
import io.ebean.event.BeanFindController;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.server.core.bootup.BootupClasses;
|
||||
import io.ebeaninternal.server.deploy.meta.DeployBeanDescriptor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.util.List;
|
||||
*/
|
||||
final class BeanFinderManager {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(BeanFinderManager.class);
|
||||
private static final Logger log = CoreLog.internal;
|
||||
|
||||
private final List<BeanFindController> list;
|
||||
|
||||
@@ -31,7 +31,7 @@ final class BeanFinderManager {
|
||||
void addFindControllers(DeployBeanDescriptor<?> deployDesc) {
|
||||
for (BeanFindController c : list) {
|
||||
if (c.isRegisterFor(deployDesc.getBeanType())) {
|
||||
logger.debug("BeanFindController on[{}] {}", deployDesc.getFullName(), c.getClass().getName());
|
||||
log.debug("BeanFindController on[{}] {}", deployDesc.getFullName(), c.getClass().getName());
|
||||
deployDesc.setBeanFinder(c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import io.ebean.core.type.ScalarType;
|
||||
import io.ebean.plugin.Property;
|
||||
import io.ebean.text.StringParser;
|
||||
import io.ebean.util.SplitName;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.api.SpiExpressionRequest;
|
||||
import io.ebeaninternal.api.SpiQuery;
|
||||
import io.ebeaninternal.api.json.SpiJsonReader;
|
||||
@@ -38,8 +39,6 @@ import io.ebeanservice.docstore.api.mapping.DocMappingBuilder;
|
||||
import io.ebeanservice.docstore.api.mapping.DocPropertyMapping;
|
||||
import io.ebeanservice.docstore.api.mapping.DocPropertyOptions;
|
||||
import io.ebeanservice.docstore.api.support.DocStructure;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.persistence.PersistenceException;
|
||||
@@ -59,8 +58,6 @@ import java.util.Set;
|
||||
*/
|
||||
public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(BeanProperty.class);
|
||||
|
||||
private static final String ENC_PREFIX = " " + EncryptAlias.PREFIX;
|
||||
|
||||
/**
|
||||
@@ -1412,7 +1409,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
objValue = null;
|
||||
String msg = "Error trying to use Jackson ObjectMapper to read transient property "
|
||||
+ fullName() + " - consider marking this property with @JsonIgnore";
|
||||
logger.error(msg, e);
|
||||
CoreLog.log.error(msg, e);
|
||||
}
|
||||
}
|
||||
if (jsonDeserialize) {
|
||||
|
||||
@@ -5,6 +5,7 @@ import io.ebean.bean.EntityBean;
|
||||
import io.ebean.core.type.DocPropertyType;
|
||||
import io.ebean.text.PathProperties;
|
||||
import io.ebean.util.SplitName;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.api.SpiEbeanServer;
|
||||
import io.ebeaninternal.api.SpiQuery;
|
||||
import io.ebeaninternal.server.core.DefaultSqlUpdate;
|
||||
@@ -24,8 +25,6 @@ import io.ebeaninternal.server.querydefn.DefaultOrmQuery;
|
||||
import io.ebeanservice.docstore.api.mapping.DocMappingBuilder;
|
||||
import io.ebeanservice.docstore.api.mapping.DocPropertyMapping;
|
||||
import io.ebeanservice.docstore.api.support.DocStructure;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.util.ArrayList;
|
||||
@@ -36,8 +35,6 @@ import java.util.List;
|
||||
*/
|
||||
public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STreePropertyAssoc {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(BeanPropertyAssoc.class);
|
||||
|
||||
/**
|
||||
* The descriptor of the target. This MUST be initialised after construction
|
||||
* so as to avoid a dependency loop between BeanDescriptors.
|
||||
@@ -435,8 +432,7 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STree
|
||||
if (!idProp.isEmbedded()) {
|
||||
// simple single scalar id
|
||||
if (cols.length != 1) {
|
||||
String msg = "No Imported Id column for [" + idProp + "] in table [" + join.getTable() + "]";
|
||||
logger.error(msg);
|
||||
CoreLog.log.error("No Imported Id column for [" + idProp + "] in table [" + join.getTable() + "]");
|
||||
return null;
|
||||
} else {
|
||||
BeanProperty[] idProps = {idProp};
|
||||
|
||||
@@ -11,10 +11,7 @@ import io.ebean.bean.EntityBean;
|
||||
import io.ebean.bean.PersistenceContext;
|
||||
import io.ebean.plugin.PropertyAssocMany;
|
||||
import io.ebean.text.PathProperties;
|
||||
import io.ebeaninternal.api.SpiEbeanServer;
|
||||
import io.ebeaninternal.api.SpiExpressionRequest;
|
||||
import io.ebeaninternal.api.SpiQuery;
|
||||
import io.ebeaninternal.api.SpiSqlUpdate;
|
||||
import io.ebeaninternal.api.*;
|
||||
import io.ebeaninternal.api.json.SpiJsonReader;
|
||||
import io.ebeaninternal.api.json.SpiJsonWriter;
|
||||
import io.ebeaninternal.server.deploy.id.ImportedId;
|
||||
@@ -23,25 +20,17 @@ import io.ebeaninternal.server.el.ElPropertyChainBuilder;
|
||||
import io.ebeaninternal.server.el.ElPropertyValue;
|
||||
import io.ebeaninternal.server.query.STreePropertyAssocMany;
|
||||
import io.ebeaninternal.server.query.SqlBeanLoad;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Property mapped to a List Set or Map.
|
||||
*/
|
||||
public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements STreePropertyAssocMany, PropertyAssocMany {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(BeanPropertyAssocMany.class);
|
||||
|
||||
private final BeanPropertyAssocManyJsonHelp jsonHelp;
|
||||
/**
|
||||
* Join for manyToMany intersection table.
|
||||
@@ -664,7 +653,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
}
|
||||
} catch (PersistenceException e) {
|
||||
// not found as individual scalar properties
|
||||
logger.error("Could not find a exported property?", e);
|
||||
CoreLog.log.error("Could not find a exported property?", e);
|
||||
}
|
||||
} else {
|
||||
if (idProp != null) {
|
||||
@@ -959,7 +948,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
setValue(bean, collection);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("Error setting value from L2 cache", e);
|
||||
CoreLog.log.error("Error setting value from L2 cache", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -972,7 +961,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
}
|
||||
return jsonWriteCollection(collection);
|
||||
} catch (Exception e) {
|
||||
logger.error("Error building value element collection json for L2 cache", e);
|
||||
CoreLog.log.error("Error building value element collection json for L2 cache", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-5
@@ -1,10 +1,9 @@
|
||||
package io.ebeaninternal.server.deploy;
|
||||
|
||||
import io.ebean.event.BeanQueryAdapter;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.server.core.bootup.BootupClasses;
|
||||
import io.ebeaninternal.server.deploy.meta.DeployBeanDescriptor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -13,8 +12,6 @@ import java.util.List;
|
||||
*/
|
||||
final class BeanQueryAdapterManager {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(BeanQueryAdapterManager.class);
|
||||
|
||||
private final List<BeanQueryAdapter> list;
|
||||
|
||||
BeanQueryAdapterManager(BootupClasses bootupClasses) {
|
||||
@@ -31,7 +28,7 @@ final class BeanQueryAdapterManager {
|
||||
void addQueryAdapter(DeployBeanDescriptor<?> deployDesc) {
|
||||
for (BeanQueryAdapter c : list) {
|
||||
if (c.isRegisterFor(deployDesc.getBeanType())) {
|
||||
logger.debug("BeanQueryAdapter on[{}] {}", deployDesc.getFullName(), c.getClass().getName());
|
||||
CoreLog.internal.debug("BeanQueryAdapter on[{}] {}", deployDesc.getFullName(), c.getClass().getName());
|
||||
deployDesc.addQueryAdapter(c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package io.ebeaninternal.server.deploy;
|
||||
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.server.core.InternString;
|
||||
import io.ebeaninternal.server.deploy.meta.DeployBeanTable;
|
||||
import io.ebeaninternal.server.deploy.meta.DeployTableJoin;
|
||||
import io.ebeaninternal.server.deploy.meta.DeployTableJoinColumn;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
@@ -19,8 +18,6 @@ import org.slf4j.LoggerFactory;
|
||||
*/
|
||||
public final class BeanTable {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(BeanTable.class);
|
||||
|
||||
private final BeanDescriptorMap owner;
|
||||
private final Class<?> beanType;
|
||||
private final String baseTable;
|
||||
@@ -108,7 +105,7 @@ public final class BeanTable {
|
||||
if (complexKey) {
|
||||
// just to copy the column name rather than prefix with the foreignKeyPrefix.
|
||||
// I think that with complex keys this is the more common approach.
|
||||
logger.debug("On table[{}] foreign key column [{}]", baseTable, lc);
|
||||
CoreLog.internal.debug("On table[{}] foreign key column [{}]", baseTable, lc);
|
||||
fk = lc;
|
||||
}
|
||||
if (sqlFormulaSelect != null) {
|
||||
|
||||
+2
-5
@@ -1,10 +1,9 @@
|
||||
package io.ebeaninternal.server.deploy;
|
||||
|
||||
import io.ebean.event.BeanPersistController;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.server.core.bootup.BootupClasses;
|
||||
import io.ebeaninternal.server.deploy.meta.DeployBeanDescriptor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -13,8 +12,6 @@ import java.util.List;
|
||||
*/
|
||||
final class PersistControllerManager {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(PersistControllerManager.class);
|
||||
|
||||
private final List<BeanPersistController> list;
|
||||
|
||||
PersistControllerManager(BootupClasses bootupClasses) {
|
||||
@@ -31,7 +28,7 @@ final class PersistControllerManager {
|
||||
void addPersistControllers(DeployBeanDescriptor<?> deployDesc) {
|
||||
for (BeanPersistController c : list) {
|
||||
if (c.isRegisterFor(deployDesc.getBeanType())) {
|
||||
logger.debug("BeanPersistController on[{}] {}", deployDesc.getFullName(), c.getClass().getName());
|
||||
CoreLog.log.debug("BeanPersistController on[{}] {}", deployDesc.getFullName(), c.getClass().getName());
|
||||
deployDesc.addPersistController(c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package io.ebeaninternal.server.deploy;
|
||||
|
||||
import io.ebean.event.BeanPersistListener;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.server.core.bootup.BootupClasses;
|
||||
import io.ebeaninternal.server.deploy.meta.DeployBeanDescriptor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -14,8 +13,6 @@ import java.util.List;
|
||||
*/
|
||||
final class PersistListenerManager {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(PersistListenerManager.class);
|
||||
|
||||
private final List<BeanPersistListener> list;
|
||||
|
||||
PersistListenerManager(BootupClasses bootupClasses) {
|
||||
@@ -32,7 +29,7 @@ final class PersistListenerManager {
|
||||
<T> void addPersistListeners(DeployBeanDescriptor<T> deployDesc) {
|
||||
for (BeanPersistListener listener : list) {
|
||||
if (listener.isRegisterFor(deployDesc.getBeanType())) {
|
||||
logger.debug("BeanPersistListener on[{}] {}", deployDesc.getFullName(), listener.getClass().getName());
|
||||
CoreLog.log.debug("BeanPersistListener on[{}] {}", deployDesc.getFullName(), listener.getClass().getName());
|
||||
deployDesc.addPersistListener(listener);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package io.ebeaninternal.server.deploy;
|
||||
|
||||
import io.ebean.event.BeanPostConstructListener;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.server.core.bootup.BootupClasses;
|
||||
import io.ebeaninternal.server.deploy.meta.DeployBeanDescriptor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -13,8 +12,6 @@ import java.util.List;
|
||||
*/
|
||||
final class PostConstructManager {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(PostConstructManager.class);
|
||||
|
||||
private final List<BeanPostConstructListener> list;
|
||||
|
||||
PostConstructManager(BootupClasses bootupClasses) {
|
||||
@@ -31,7 +28,7 @@ final class PostConstructManager {
|
||||
void addPostConstructListeners(DeployBeanDescriptor<?> deployDesc) {
|
||||
for (BeanPostConstructListener c : list) {
|
||||
if (c.isRegisterFor(deployDesc.getBeanType())) {
|
||||
logger.debug("BeanPostLoad on[{}] {}", deployDesc.getFullName(), c.getClass().getName());
|
||||
CoreLog.log.debug("BeanPostLoad on[{}] {}", deployDesc.getFullName(), c.getClass().getName());
|
||||
deployDesc.addPostConstructListener(c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package io.ebeaninternal.server.deploy;
|
||||
|
||||
import io.ebean.event.BeanPostLoad;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.server.core.bootup.BootupClasses;
|
||||
import io.ebeaninternal.server.deploy.meta.DeployBeanDescriptor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -13,8 +12,6 @@ import java.util.List;
|
||||
*/
|
||||
final class PostLoadManager {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(PostLoadManager.class);
|
||||
|
||||
private final List<BeanPostLoad> list;
|
||||
|
||||
PostLoadManager(BootupClasses bootupClasses) {
|
||||
@@ -31,7 +28,7 @@ final class PostLoadManager {
|
||||
void addPostLoad(DeployBeanDescriptor<?> deployDesc) {
|
||||
for (BeanPostLoad c : list) {
|
||||
if (c.isRegisterFor(deployDesc.getBeanType())) {
|
||||
logger.debug("BeanPostLoad on[{}] {}", deployDesc.getFullName(), c.getClass().getName());
|
||||
CoreLog.log.debug("BeanPostLoad on[{}] {}", deployDesc.getFullName(), c.getClass().getName());
|
||||
deployDesc.addPostLoad(c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public final class IdBinderSimple implements IdBinder {
|
||||
this.idProperty = idProperty;
|
||||
this.scalarType = idProperty.scalarType();
|
||||
this.expectedType = idProperty.type();
|
||||
bindIdSql = InternString.intern(idProperty.dbColumn() + " = ? ");
|
||||
bindIdSql = InternString.intern(idProperty.dbColumn() + " = ?");
|
||||
this.multiValueBind = multiValueBind;
|
||||
}
|
||||
|
||||
|
||||
+2
-5
@@ -1,12 +1,11 @@
|
||||
package io.ebeaninternal.server.deploy.meta;
|
||||
|
||||
import io.ebean.bean.EntityBean;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.server.deploy.*;
|
||||
import io.ebeaninternal.server.deploy.generatedproperty.GeneratedProperty;
|
||||
import io.ebeaninternal.server.properties.BeanPropertySetter;
|
||||
import io.ebeaninternal.server.type.ScalarTypeString;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -17,8 +16,6 @@ import java.util.List;
|
||||
*/
|
||||
public final class DeployBeanPropertyLists {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(DeployBeanPropertyLists.class);
|
||||
|
||||
private static final NoopSetter NOOP_SETTER = new NoopSetter();
|
||||
|
||||
private BeanProperty versionProperty;
|
||||
@@ -225,7 +222,7 @@ public final class DeployBeanPropertyLists {
|
||||
if (versionProperty == null) {
|
||||
versionProperty = prop;
|
||||
} else {
|
||||
logger.warn("Multiple @Version properties - property " + prop.fullName() + " not treated as a version property");
|
||||
CoreLog.internal.warn("Multiple @Version properties - property " + prop.fullName() + " not treated as a version property");
|
||||
}
|
||||
} else if (prop.isDraftDirty()) {
|
||||
draftDirty = prop;
|
||||
|
||||
+4
-17
@@ -5,6 +5,7 @@ import io.ebean.annotation.FetchPreference;
|
||||
import io.ebean.annotation.TenantId;
|
||||
import io.ebean.annotation.Where;
|
||||
import io.ebean.config.NamingConvention;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.server.deploy.BeanDescriptorManager;
|
||||
import io.ebeaninternal.server.deploy.BeanTable;
|
||||
import io.ebeaninternal.server.deploy.PropertyForeignKey;
|
||||
@@ -12,28 +13,14 @@ import io.ebeaninternal.server.deploy.meta.DeployBeanProperty;
|
||||
import io.ebeaninternal.server.deploy.meta.DeployBeanPropertyAssocOne;
|
||||
import io.ebeaninternal.server.deploy.meta.DeployTableJoinColumn;
|
||||
import io.ebeaninternal.server.query.SqlJoinType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.ConstraintMode;
|
||||
import javax.persistence.Embedded;
|
||||
import javax.persistence.EmbeddedId;
|
||||
import javax.persistence.ForeignKey;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.PrimaryKeyJoinColumn;
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
* Read the deployment annotations for Associated One beans.
|
||||
*/
|
||||
final class AnnotationAssocOnes extends AnnotationAssoc {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(AnnotationAssocOnes.class);
|
||||
|
||||
/**
|
||||
* Create with the deploy Info.
|
||||
*/
|
||||
@@ -226,10 +213,10 @@ final class AnnotationAssocOnes extends AnnotationAssoc {
|
||||
prop.setPrimaryKeyJoin(true);
|
||||
|
||||
if (!primaryKeyJoin.name().isEmpty()) {
|
||||
log.info("Automatically determining join columns for @PrimaryKeyJoinColumn - ignoring PrimaryKeyJoinColumn.name attribute [{}] on {}", primaryKeyJoin.name(), prop.getFullBeanName());
|
||||
CoreLog.internal.info("Automatically determining join columns for @PrimaryKeyJoinColumn - ignoring PrimaryKeyJoinColumn.name attribute [{}] on {}", primaryKeyJoin.name(), prop.getFullBeanName());
|
||||
}
|
||||
if (!primaryKeyJoin.referencedColumnName().isEmpty()) {
|
||||
log.info("Automatically determining join columns for @PrimaryKeyJoinColumn - Ignoring PrimaryKeyJoinColumn.referencedColumnName attribute [{}] on {}", primaryKeyJoin.referencedColumnName(), prop.getFullBeanName());
|
||||
CoreLog.internal.info("Automatically determining join columns for @PrimaryKeyJoinColumn - Ignoring PrimaryKeyJoinColumn.referencedColumnName attribute [{}] on {}", primaryKeyJoin.referencedColumnName(), prop.getFullBeanName());
|
||||
}
|
||||
BeanTable baseBeanTable = factory.beanTable(info.getDescriptor().getBeanType());
|
||||
String localPrimaryKey = baseBeanTable.getIdColumn();
|
||||
|
||||
@@ -14,13 +14,12 @@ import io.ebean.annotation.ReadAudit;
|
||||
import io.ebean.annotation.StorageEngine;
|
||||
import io.ebean.annotation.View;
|
||||
import io.ebean.config.TableName;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.server.deploy.BeanDescriptor.EntityType;
|
||||
import io.ebeaninternal.server.deploy.IndexDefinition;
|
||||
import io.ebeaninternal.server.deploy.InheritInfo;
|
||||
import io.ebeaninternal.server.deploy.PartitionMeta;
|
||||
import io.ebeaninternal.server.deploy.meta.DeployBeanProperty;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.persistence.AttributeOverride;
|
||||
import javax.persistence.Column;
|
||||
@@ -38,8 +37,6 @@ import static io.ebean.util.AnnotationUtil.typeGet;
|
||||
*/
|
||||
final class AnnotationClass extends AnnotationParser {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(AnnotationClass.class);
|
||||
|
||||
private final String asOfViewSuffix;
|
||||
private final String versionsBetweenSuffix;
|
||||
private final boolean disableL2Cache;
|
||||
@@ -66,7 +63,7 @@ final class AnnotationClass extends AnnotationParser {
|
||||
Column column = override.column();
|
||||
DeployBeanProperty beanProperty = descriptor.getBeanProperty(propertyName);
|
||||
if (beanProperty == null) {
|
||||
logger.error("AttributeOverride property [" + propertyName + "] not found on " + descriptor.getFullName());
|
||||
CoreLog.log.error("AttributeOverride property [" + propertyName + "] not found on " + descriptor.getFullName());
|
||||
} else {
|
||||
readColumn(column, beanProperty);
|
||||
}
|
||||
|
||||
+8
-24
@@ -1,32 +1,18 @@
|
||||
package io.ebeaninternal.server.deploy.parse;
|
||||
|
||||
import io.ebean.Model;
|
||||
import io.ebean.annotation.DbArray;
|
||||
import io.ebean.annotation.DbJson;
|
||||
import io.ebean.annotation.DbJsonB;
|
||||
import io.ebean.annotation.DbMap;
|
||||
import io.ebean.annotation.UnmappedJson;
|
||||
import io.ebean.annotation.*;
|
||||
import io.ebean.core.type.ScalarType;
|
||||
import io.ebean.util.AnnotationUtil;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.server.deploy.DetermineManyType;
|
||||
import io.ebeaninternal.server.deploy.ManyType;
|
||||
import io.ebeaninternal.server.deploy.meta.DeployBeanDescriptor;
|
||||
import io.ebeaninternal.server.deploy.meta.DeployBeanProperty;
|
||||
import io.ebeaninternal.server.deploy.meta.DeployBeanPropertyAssocMany;
|
||||
import io.ebeaninternal.server.deploy.meta.DeployBeanPropertyAssocOne;
|
||||
import io.ebeaninternal.server.deploy.meta.DeployBeanPropertySimpleCollection;
|
||||
import io.ebeaninternal.server.deploy.meta.*;
|
||||
import io.ebeaninternal.server.type.TypeManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.persistence.Transient;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.Type;
|
||||
import java.lang.reflect.WildcardType;
|
||||
import java.lang.reflect.*;
|
||||
|
||||
/**
|
||||
* Create the properties for a bean.
|
||||
@@ -37,8 +23,6 @@ import java.lang.reflect.WildcardType;
|
||||
*/
|
||||
public final class DeployCreateProperties {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(DeployCreateProperties.class);
|
||||
|
||||
private final DetermineManyType determineManyType;
|
||||
private final TypeManager typeManager;
|
||||
|
||||
@@ -101,7 +85,7 @@ public final class DeployCreateProperties {
|
||||
if (replaced != null && !replaced.isTransient()) {
|
||||
String msg = "Huh??? property " + prop.getFullBeanName() + " being defined twice";
|
||||
msg += " but replaced property was not transient? This is not expected?";
|
||||
logger.warn(msg);
|
||||
CoreLog.log.warn(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -128,7 +112,7 @@ public final class DeployCreateProperties {
|
||||
return new DeployBeanPropertySimpleCollection(desc, targetType, manyType);
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
logger.debug("expected non-scalar type {}", e.getMessage());
|
||||
CoreLog.internal.debug("expected non-scalar type {}", e.getMessage());
|
||||
}
|
||||
return new DeployBeanPropertyAssocMany(desc, targetType, manyType);
|
||||
}
|
||||
@@ -149,7 +133,7 @@ public final class DeployCreateProperties {
|
||||
// not supporting this field (generic type used)
|
||||
return null;
|
||||
}
|
||||
logger.warn("Could not find parameter type (via reflection) on " + desc.getFullName() + " " + field.getName());
|
||||
CoreLog.internal.warn("Could not find parameter type (via reflection) on " + desc.getFullName() + " " + field.getName());
|
||||
}
|
||||
return createManyType(desc, targetType, manyType);
|
||||
}
|
||||
@@ -168,7 +152,7 @@ public final class DeployCreateProperties {
|
||||
return new DeployBeanPropertyAssocOne(desc, propertyType);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Error with " + desc + " field:" + field.getName(), e);
|
||||
CoreLog.log.error("Error with " + desc + " field:" + field.getName(), e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,10 +24,8 @@ final class DtoMeta {
|
||||
propMap.put(property.getName().toUpperCase(), property);
|
||||
}
|
||||
int maxArg = 0;
|
||||
|
||||
DtoMetaConstructor defaultConstructor = null;
|
||||
DtoMetaConstructor maxArgConstructor = null;
|
||||
|
||||
for (DtoMetaConstructor constructor : constructors) {
|
||||
int args = constructor.getArgCount();
|
||||
constructorMap.put(args, constructor);
|
||||
@@ -56,7 +54,6 @@ final class DtoMeta {
|
||||
if (defaultConstructor != null) {
|
||||
return matchSetters(request);
|
||||
}
|
||||
|
||||
String msg = "Unable to map the resultSet columns " + Arrays.toString(cols)
|
||||
+ " to the bean type ["+dtoType+"] as the number of columns in the resultSet is less than the constructor"
|
||||
+ " (and that there is no default constructor) ?";
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package io.ebeaninternal.server.dto;
|
||||
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.server.type.TypeManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Method;
|
||||
@@ -17,8 +16,6 @@ import java.util.List;
|
||||
*/
|
||||
final class DtoMetaBuilder {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(DtoMetaBuilder.class);
|
||||
|
||||
private final TypeManager typeManager;
|
||||
private final Class<?> dtoType;
|
||||
private final List<DtoMetaProperty> properties = new ArrayList<>();
|
||||
@@ -43,7 +40,7 @@ final class DtoMetaBuilder {
|
||||
final Class<?> propertyType = propertyType(method);
|
||||
properties.add(new DtoMetaProperty(typeManager, dtoType, method, name, propertyType));
|
||||
} catch (Exception e) {
|
||||
log.debug("exclude on " + dtoType + " method " + method, e);
|
||||
CoreLog.log.debug("exclude on " + dtoType + " method " + method, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -71,13 +68,12 @@ final class DtoMetaBuilder {
|
||||
}
|
||||
|
||||
private void readConstructors() {
|
||||
Constructor<?>[] constructors = dtoType.getConstructors();
|
||||
for (Constructor<?> constructor : constructors) {
|
||||
for (Constructor<?> constructor : dtoType.getConstructors()) {
|
||||
try {
|
||||
constructorList.add(new DtoMetaConstructor(typeManager, constructor, dtoType));
|
||||
} catch (Exception e) {
|
||||
// we don't want that constructor
|
||||
log.debug("exclude on " + dtoType + " constructor " + constructor, e);
|
||||
CoreLog.log.debug("exclude on " + dtoType + " constructor " + constructor, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
-7
@@ -1,7 +1,7 @@
|
||||
package io.ebeaninternal.server.executor;
|
||||
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -12,7 +12,7 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
*/
|
||||
public final class DaemonScheduleThreadPool extends ScheduledThreadPoolExecutor {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(DaemonScheduleThreadPool.class);
|
||||
private static final Logger log = CoreLog.log;
|
||||
|
||||
private final ReentrantLock lock = new ReentrantLock();
|
||||
private final String namePrefix;
|
||||
@@ -38,19 +38,19 @@ public final class DaemonScheduleThreadPool extends ScheduledThreadPoolExecutor
|
||||
lock.lock();
|
||||
try {
|
||||
if (super.isShutdown()) {
|
||||
logger.debug("Already shutdown {}", namePrefix);
|
||||
log.debug("Already shutdown threadPool {}", namePrefix);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
logger.trace("Shutting down {} ...", namePrefix);
|
||||
log.trace("shutting down threadPool {}", namePrefix);
|
||||
super.shutdown();
|
||||
if (!super.awaitTermination(shutdownWaitSeconds, TimeUnit.SECONDS)) {
|
||||
logger.info("Shutdown wait timeout exceeded. Terminating running threads for {}", namePrefix);
|
||||
log.info("Shutdown wait timeout exceeded. Terminating running threads for {}", namePrefix);
|
||||
super.shutdownNow();
|
||||
}
|
||||
logger.debug("Shutdown complete for {}", namePrefix);
|
||||
log.trace("shutdown complete for threadPool {}", namePrefix);
|
||||
} catch (Exception e) {
|
||||
logger.error("Error during shutdown of " + namePrefix, e);
|
||||
log.error("Error during shutdown of threadPool " + namePrefix, e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
} finally {
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package io.ebeaninternal.server.expression;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Id IN expression common for cache handling.
|
||||
*/
|
||||
public interface IdInCommon {
|
||||
|
||||
/**
|
||||
* Return the ids this expression is looking to fetch.
|
||||
*/
|
||||
Collection<?> idValues();
|
||||
|
||||
/**
|
||||
* Remove Ids that where obtained from l2 cache. Don't fetch these from DB.
|
||||
*/
|
||||
int removeIds(Set<Object> hitIds);
|
||||
}
|
||||
@@ -20,7 +20,7 @@ import java.util.Set;
|
||||
/**
|
||||
* In a collection of Id values.
|
||||
*/
|
||||
public final class IdInExpression extends NonPrepareExpression {
|
||||
public final class IdInExpression extends NonPrepareExpression implements IdInCommon {
|
||||
|
||||
private final List<Object> idCollection;
|
||||
private boolean multiValueIdSupported;
|
||||
@@ -29,16 +29,12 @@ public final class IdInExpression extends NonPrepareExpression {
|
||||
this.idCollection = new ArrayList<>(idCollection);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the ids this expression is looking to fetch.
|
||||
*/
|
||||
@Override
|
||||
public Collection<Object> idValues() {
|
||||
return idCollection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove Ids that where obtained from l2 cache. Don't fetch these from DB.
|
||||
*/
|
||||
@Override
|
||||
public int removeIds(Set<Object> hitIds) {
|
||||
idCollection.removeAll(hitIds);
|
||||
return idCollection.size();
|
||||
|
||||
@@ -10,13 +10,9 @@ import io.ebeaninternal.server.el.ElPropertyValue;
|
||||
import io.ebeaninternal.server.persist.MultiValueWrapper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
final class InExpression extends AbstractExpression {
|
||||
public final class InExpression extends AbstractExpression implements IdInCommon {
|
||||
|
||||
private final boolean not;
|
||||
|
||||
@@ -49,6 +45,24 @@ final class InExpression extends AbstractExpression {
|
||||
this.empty = false;
|
||||
}
|
||||
|
||||
public String property() {
|
||||
return propName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<?> idValues() {
|
||||
if (bindValues == null) {
|
||||
bindValues = new ArrayList<>(sourceValues);
|
||||
}
|
||||
return bindValues;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int removeIds(Set<Object> hitIds) {
|
||||
bindValues.removeAll(hitIds);
|
||||
return bindValues.size();
|
||||
}
|
||||
|
||||
private List<Object> values() {
|
||||
if (empty || sourceValues == null) {
|
||||
return Collections.emptyList();
|
||||
|
||||
@@ -24,14 +24,14 @@ final class InPairsExpression extends AbstractExpression {
|
||||
private List<Object> concatBindValues;
|
||||
|
||||
InPairsExpression(Pairs pairs, boolean not) {
|
||||
super(pairs.getProperty0());
|
||||
this.property0 = pairs.getProperty0();
|
||||
this.property1 = pairs.getProperty1();
|
||||
super(pairs.property0());
|
||||
this.property0 = pairs.property0();
|
||||
this.property1 = pairs.property1();
|
||||
// the entries might be modified on cache hit.
|
||||
this.entries = pairs.getEntries();
|
||||
this.entries = pairs.entries();
|
||||
this.not = not;
|
||||
this.separator = pairs.getConcatSeparator();
|
||||
this.suffix = pairs.getConcatSuffix();
|
||||
this.separator = pairs.concatSeparator();
|
||||
this.suffix = pairs.concatSuffix();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,23 +1,11 @@
|
||||
package io.ebeaninternal.server.idgen;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.*;
|
||||
import java.net.NetworkInterface;
|
||||
import java.net.SocketException;
|
||||
import java.util.Date;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* IdGenerator for java util UUID.
|
||||
*
|
||||
@@ -28,16 +16,12 @@ import org.slf4j.LoggerFactory;
|
||||
*/
|
||||
public class UuidV1IdGenerator extends UuidV1RndIdGenerator {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger("io.ebean.IDGEN");
|
||||
private static final Map<File, UuidV1IdGenerator> INSTANCES = new ConcurrentHashMap<>();
|
||||
|
||||
private final File stateFile;
|
||||
|
||||
private byte[] nodeId = null;
|
||||
|
||||
private byte[] nodeId;
|
||||
private boolean canSaveState = true;
|
||||
|
||||
private static final Map<File, UuidV1IdGenerator> INSTANCES = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* Returns an instance for given file.
|
||||
*/
|
||||
@@ -88,21 +72,21 @@ public class UuidV1IdGenerator extends UuidV1RndIdGenerator {
|
||||
while (e.hasMoreElements()) {
|
||||
NetworkInterface network = e.nextElement();
|
||||
try {
|
||||
logger.trace("Probing interface {}", network);
|
||||
log.trace("Probing interface {}", network);
|
||||
if (!network.isLoopback()) {
|
||||
byte[] addr = network.getHardwareAddress();
|
||||
if (validAddr(addr)) {
|
||||
if (network.isUp() && !network.isVirtual()) {
|
||||
logger.debug("Using interface {}", network);
|
||||
log.debug("Using interface {}", network);
|
||||
return addr;
|
||||
} else if (fallbackAddr == null) {
|
||||
logger.debug("Using interface {} as fallback", network);
|
||||
log.debug("Using interface {} as fallback", network);
|
||||
fallbackAddr = addr;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (SocketException ex) {
|
||||
logger.debug("Skipping {}", network, ex);
|
||||
log.debug("Skipping {}", network, ex);
|
||||
}
|
||||
}
|
||||
return fallbackAddr;
|
||||
@@ -131,16 +115,16 @@ public class UuidV1IdGenerator extends UuidV1RndIdGenerator {
|
||||
// See, if there is an alternative MAC address set.
|
||||
nodeId = getAlternativeNodeId();
|
||||
if (nodeId != null) {
|
||||
logger.info("Using alternative MAC {} to generate Type 1 UUIDs", getNodeIdentifier());
|
||||
log.info("Using alternative MAC {} to generate Type 1 UUIDs", getNodeIdentifier());
|
||||
} else {
|
||||
nodeId = getHardwareId();
|
||||
logger.info("Using MAC {} to generate Type 1 UUIDs", getNodeIdentifier());
|
||||
log.info("Using MAC {} to generate Type 1 UUIDs", getNodeIdentifier());
|
||||
}
|
||||
if (nodeId == null) {
|
||||
canSaveState = false;
|
||||
// RFC 4.5 use random portion for node
|
||||
nodeId = super.getNodeIdBytes();
|
||||
logger.error("Have to fall back to random node identifier {} (Reason: No suitable network interface found)", getNodeIdentifier());
|
||||
log.error("Have to fall back to random node identifier {} (Reason: No suitable network interface found)", getNodeIdentifier());
|
||||
|
||||
} else {
|
||||
boolean flag = restoreState();
|
||||
@@ -150,14 +134,14 @@ public class UuidV1IdGenerator extends UuidV1RndIdGenerator {
|
||||
ts /= MILLIS_TO_UUID;
|
||||
|
||||
saveState();
|
||||
logger.debug("RestoreState: {}, ClockSeq {}, Timestamp {}, uuid {}, stateFile: {})", flag, clockSeq.get(),
|
||||
log.debug("RestoreState: {}, ClockSeq {}, Timestamp {}, uuid {}, stateFile: {})", flag, clockSeq.get(),
|
||||
new Date(ts), uuid, stateFile);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
canSaveState = false;
|
||||
// RFC 4.5 use random portion for node
|
||||
nodeId = super.getNodeIdBytes();
|
||||
logger.error("Have to fall back to random node identifier {} (Reason: {} )", getNodeIdentifier(), e.getMessage());
|
||||
log.error("Have to fall back to random node identifier {} (Reason: {} )", getNodeIdentifier(), e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,7 +175,7 @@ public class UuidV1IdGenerator extends UuidV1RndIdGenerator {
|
||||
Long ts = Long.valueOf(prop.getProperty("timeStamp"));
|
||||
clockSeq.set(seq);
|
||||
timeStamp.set(ts);
|
||||
logger.debug("Restored state from '{}'", stateFile);
|
||||
log.debug("Restored state from '{}'", stateFile);
|
||||
return true;
|
||||
} catch (NumberFormatException nfe) {
|
||||
// nop
|
||||
@@ -218,9 +202,9 @@ public class UuidV1IdGenerator extends UuidV1RndIdGenerator {
|
||||
}
|
||||
try (OutputStream os = new FileOutputStream(stateFile)) {
|
||||
prop.store(os, "ebean uuid state file");
|
||||
logger.debug("Persisted state to '{}'", stateFile);
|
||||
log.debug("Persisted state to '{}'", stateFile);
|
||||
} catch (IOException e) {
|
||||
logger.error("Could not persist uuid state to '{}'", stateFile, e);
|
||||
log.error("Could not persist uuid state to '{}'", stateFile, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.slf4j.LoggerFactory;
|
||||
*/
|
||||
public class UuidV1RndIdGenerator implements PlatformIdGenerator {
|
||||
|
||||
protected static final Logger logger = LoggerFactory.getLogger("io.ebean.IDGEN");
|
||||
protected static final Logger log = LoggerFactory.getLogger("io.ebean.IDGEN");
|
||||
|
||||
// UUID epoch 1582-10-15 00:00:00 and the Unix epoch 1970-01-01 00:00:00.
|
||||
protected static final long UUID_EPOCH_OFFSET = 0x01B21DD213814000L;
|
||||
@@ -106,7 +106,7 @@ public class UuidV1RndIdGenerator implements PlatformIdGenerator {
|
||||
|
||||
delta = current - last;
|
||||
if (delta < -10000 * 20000) {
|
||||
logger.info("Clock skew of {} ms detected", delta / -10000);
|
||||
log.info("Clock skew of {} ms detected", delta / -10000);
|
||||
// The clock was adjusted back about 2 seconds, or we were generating a lot of ids too fast
|
||||
// if so, we try to set the current as last and also increment the clockSeq.
|
||||
lock.lock();
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package io.ebeaninternal.server.persist;
|
||||
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.api.SpiProfileTransactionEvent;
|
||||
import io.ebeaninternal.api.SpiTransaction;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -22,8 +21,6 @@ import java.util.List;
|
||||
*/
|
||||
public final class BatchedPstmt implements SpiProfileTransactionEvent {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(BatchedPstmt.class);
|
||||
|
||||
/**
|
||||
* The underlying statement.
|
||||
*/
|
||||
@@ -144,7 +141,7 @@ public final class BatchedPstmt implements SpiProfileTransactionEvent {
|
||||
try {
|
||||
pstmt.close();
|
||||
} catch (SQLException e) {
|
||||
log.warn("Error closing statement", e);
|
||||
CoreLog.log.warn("BatchedPstmt Error closing statement", e);
|
||||
} finally {
|
||||
pstmt = null;
|
||||
}
|
||||
@@ -208,7 +205,7 @@ public final class BatchedPstmt implements SpiProfileTransactionEvent {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException e) {
|
||||
log.warn("Error closing inputStream ", e);
|
||||
CoreLog.log.warn("BatchedPstmt Error closing inputStream ", e);
|
||||
}
|
||||
}
|
||||
inputStreams = null;
|
||||
|
||||
@@ -4,27 +4,16 @@ import io.ebean.config.dbplatform.DbPlatformType;
|
||||
import io.ebean.core.type.DataReader;
|
||||
import io.ebean.core.type.ScalarType;
|
||||
import io.ebeaninternal.api.BindParams;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.api.SpiLogManager;
|
||||
import io.ebeaninternal.server.core.timezone.DataTimeZone;
|
||||
import io.ebeaninternal.server.expression.platform.DbExpressionHandler;
|
||||
import io.ebeaninternal.server.persist.platform.MultiValueBind;
|
||||
import io.ebeaninternal.server.type.DataBind;
|
||||
import io.ebeaninternal.server.type.GeoTypeBinder;
|
||||
import io.ebeaninternal.server.type.PostgresHelper;
|
||||
import io.ebeaninternal.server.type.RsetDataReader;
|
||||
import io.ebeaninternal.server.type.TypeManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import io.ebeaninternal.server.type.*;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
import java.util.ArrayList;
|
||||
import java.sql.*;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@@ -33,8 +22,6 @@ import java.util.List;
|
||||
*/
|
||||
public final class Binder {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(Binder.class);
|
||||
|
||||
private final TypeManager typeManager;
|
||||
private final int asOfBindCount;
|
||||
private final boolean asOfStandardsBased;
|
||||
@@ -131,7 +118,11 @@ public final class Binder {
|
||||
bindLog.append(value);
|
||||
}
|
||||
}
|
||||
if (value == null) {
|
||||
if (value instanceof Collection) {
|
||||
for (Object entry: (Collection<?>) value) {
|
||||
bindObject(dataBind, entry);
|
||||
}
|
||||
} else if (value == null) {
|
||||
// this doesn't work for query predicates
|
||||
bindObject(dataBind, null, param.getType());
|
||||
} else {
|
||||
@@ -141,7 +132,7 @@ public final class Binder {
|
||||
}
|
||||
|
||||
} catch (SQLException ex) {
|
||||
logger.warn("error binding parameter [{}][{}]", (dataBind.currentPos() - 1), value);
|
||||
CoreLog.log.warn("error binding parameter [{}][{}]", (dataBind.currentPos() - 1), value);
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
@@ -303,6 +294,7 @@ public final class Binder {
|
||||
break;
|
||||
|
||||
case java.sql.Types.TIMESTAMP:
|
||||
case DbPlatformType.LOCALDATETIME:
|
||||
b.setTimestamp((java.sql.Timestamp) data);
|
||||
break;
|
||||
|
||||
|
||||
@@ -12,10 +12,7 @@ import io.ebean.bean.EntityBean;
|
||||
import io.ebean.bean.PersistenceContext;
|
||||
import io.ebean.event.BeanPersistController;
|
||||
import io.ebean.meta.MetricVisitor;
|
||||
import io.ebeaninternal.api.SpiEbeanServer;
|
||||
import io.ebeaninternal.api.SpiSqlUpdate;
|
||||
import io.ebeaninternal.api.SpiTransaction;
|
||||
import io.ebeaninternal.api.SpiUpdate;
|
||||
import io.ebeaninternal.api.*;
|
||||
import io.ebeaninternal.server.core.PersistRequest;
|
||||
import io.ebeaninternal.server.core.PersistRequest.Type;
|
||||
import io.ebeaninternal.server.core.PersistRequestBean;
|
||||
@@ -58,8 +55,7 @@ import java.util.Set;
|
||||
public final class DefaultPersister implements Persister {
|
||||
|
||||
private static final Logger PUB = LoggerFactory.getLogger("io.ebean.PUB");
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(DefaultPersister.class);
|
||||
private static final Logger log = CoreLog.internal;
|
||||
|
||||
/**
|
||||
* Actually does the persisting work.
|
||||
@@ -539,8 +535,8 @@ public final class DefaultPersister implements Persister {
|
||||
if (request.isDirty()) {
|
||||
request.executeOrQueue();
|
||||
|
||||
} else if (logger.isDebugEnabled()) {
|
||||
logger.debug("Update skipped as bean is unchanged: {}", request.bean());
|
||||
} else if (log.isDebugEnabled()) {
|
||||
log.debug("Update skipped as bean is unchanged: {}", request.bean());
|
||||
}
|
||||
|
||||
if (request.isPersistCascade()) {
|
||||
@@ -587,16 +583,14 @@ public final class DefaultPersister implements Persister {
|
||||
* A common transaction is used across both requests.
|
||||
*/
|
||||
private int deleteRequest(PersistRequestBean<?> req, PersistRequestBean<?> draftReq) {
|
||||
|
||||
if (req.isRegisteredForDeleteBean()) {
|
||||
// skip deleting bean. Used where cascade is on
|
||||
// both sides of a relationship
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("skipping delete on alreadyRegistered " + req.bean());
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("skipping delete on alreadyRegistered {}", req.bean());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
try {
|
||||
req.initTransIfRequiredWithBatchCascade();
|
||||
int rows = delete(req);
|
||||
|
||||
@@ -2,12 +2,11 @@ package io.ebeaninternal.server.persist;
|
||||
|
||||
import io.ebean.bean.BeanCollection;
|
||||
import io.ebean.bean.EntityBean;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.api.SpiEbeanServer;
|
||||
import io.ebeaninternal.api.SpiTransaction;
|
||||
import io.ebeaninternal.server.core.PersistRequestBean;
|
||||
import io.ebeaninternal.server.deploy.BeanPropertyAssocMany;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -16,8 +15,6 @@ import java.io.IOException;
|
||||
*/
|
||||
abstract class SaveManyBase implements SaveMany {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SaveManyBase.class);
|
||||
|
||||
final DefaultPersister persister;
|
||||
final PersistRequestBean<?> request;
|
||||
final SpiEbeanServer server;
|
||||
@@ -74,7 +71,7 @@ abstract class SaveManyBase implements SaveMany {
|
||||
String asJson = many.jsonWriteCollection(value);
|
||||
request.addCollectionChange(many.name(), asJson);
|
||||
} catch (IOException e) {
|
||||
log.error("Error build element collection entry for L2 cache", e);
|
||||
CoreLog.log.error("Error build element collection entry for L2 cache", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package io.ebeaninternal.server.persist;
|
||||
import io.ebean.bean.BeanCollection;
|
||||
import io.ebean.bean.EntityBean;
|
||||
import io.ebean.bean.EntityBeanIntercept;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.api.SpiSqlUpdate;
|
||||
import io.ebeaninternal.server.core.PersistRequestBean;
|
||||
import io.ebeaninternal.server.deploy.BeanCollectionUtil;
|
||||
@@ -10,8 +11,6 @@ import io.ebeaninternal.server.deploy.BeanDescriptor;
|
||||
import io.ebeaninternal.server.deploy.BeanProperty;
|
||||
import io.ebeaninternal.server.deploy.BeanPropertyAssocMany;
|
||||
import io.ebeaninternal.server.deploy.IntersectionRow;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.util.ArrayList;
|
||||
@@ -27,8 +26,6 @@ import static io.ebeaninternal.server.persist.DmlUtil.isNullOrZero;
|
||||
*/
|
||||
public final class SaveManyBeans extends SaveManyBase {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SaveManyBeans.class);
|
||||
|
||||
private final boolean cascade;
|
||||
private final boolean publish;
|
||||
private final BeanDescriptor<?> targetDescriptor;
|
||||
@@ -317,7 +314,7 @@ public final class SaveManyBeans extends SaveManyBase {
|
||||
if (transaction.isLogSummary()) {
|
||||
transaction.logSummary(m);
|
||||
}
|
||||
log.warn(m);
|
||||
CoreLog.log.warn(m);
|
||||
} else {
|
||||
if (!many.hasImportedId(otherBean)) {
|
||||
throw new PersistenceException("ManyToMany bean " + otherBean + " does not have an Id value.");
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
package io.ebeaninternal.server.persist.dml;
|
||||
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.api.SpiTransaction;
|
||||
import io.ebeaninternal.server.core.PersistRequestBean;
|
||||
import io.ebeaninternal.server.deploy.BeanProperty;
|
||||
import io.ebeaninternal.server.util.Str;
|
||||
import io.ebeaninternal.server.persist.BatchedPstmt;
|
||||
import io.ebeaninternal.server.persist.BatchedPstmtHolder;
|
||||
import io.ebeaninternal.server.persist.dmlbind.BindableRequest;
|
||||
import io.ebeaninternal.server.type.DataBind;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import io.ebeaninternal.server.util.Str;
|
||||
|
||||
import javax.persistence.OptimisticLockException;
|
||||
import java.sql.Connection;
|
||||
@@ -21,8 +20,6 @@ import java.sql.SQLException;
|
||||
*/
|
||||
public abstract class DmlHandler implements PersistHandler, BindableRequest {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(DmlHandler.class);
|
||||
|
||||
private static final int[] GENERATED_KEY_COLUMNS = new int[]{1};
|
||||
private static final short BATCHED_FIRST = 1;
|
||||
private static final short BATCHED = 2;
|
||||
@@ -126,7 +123,7 @@ public abstract class DmlHandler implements PersistHandler, BindableRequest {
|
||||
dataBind.close();
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
logger.error(null, ex);
|
||||
CoreLog.log.error(null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -73,6 +73,7 @@ abstract class AbstractMultiValueBind extends MultiValueBind {
|
||||
case TIMESTAMP:
|
||||
case TIME_WITH_TIMEZONE:
|
||||
case TIMESTAMP_WITH_TIMEZONE:
|
||||
case ExtraDbTypes.LOCALDATETIME:
|
||||
return "timestamp";
|
||||
//case LONGVARCHAR:
|
||||
//case CLOB:
|
||||
|
||||
@@ -7,6 +7,7 @@ import io.ebean.bean.*;
|
||||
import io.ebean.core.type.DataReader;
|
||||
import io.ebean.event.readaudit.ReadEvent;
|
||||
import io.ebean.util.JdbcClose;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.api.SpiProfileTransactionEvent;
|
||||
import io.ebeaninternal.api.SpiQuery;
|
||||
import io.ebeaninternal.api.SpiQuery.Mode;
|
||||
@@ -15,8 +16,6 @@ import io.ebeaninternal.server.autotune.ProfilingListener;
|
||||
import io.ebeaninternal.server.core.OrmQueryRequest;
|
||||
import io.ebeaninternal.server.core.SpiOrmQueryRequest;
|
||||
import io.ebeaninternal.server.deploy.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.lang.ref.WeakReference;
|
||||
@@ -39,8 +38,6 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
*/
|
||||
public final class CQuery<T> implements DbReadContext, CancelableQuery, SpiProfileTransactionEvent {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(CQuery.class);
|
||||
|
||||
private static final CQueryCollectionAddNoop NOOP_ADD = new CQueryCollectionAddNoop();
|
||||
|
||||
private final ReentrantLock lock = new ReentrantLock();
|
||||
@@ -351,7 +348,7 @@ public final class CQuery<T> implements DbReadContext, CancelableQuery, SpiProfi
|
||||
auditIterateLogMessage();
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
logger.error("Error logging read audit logs", e);
|
||||
CoreLog.log.error("Error logging read audit logs", e);
|
||||
}
|
||||
try {
|
||||
if (dataReader != null) {
|
||||
@@ -359,7 +356,7 @@ public final class CQuery<T> implements DbReadContext, CancelableQuery, SpiProfi
|
||||
dataReader = null;
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
logger.error("Error closing dataReader", e);
|
||||
CoreLog.log.error("Error closing dataReader", e);
|
||||
}
|
||||
JdbcClose.close(pstmt);
|
||||
pstmt = null;
|
||||
@@ -419,7 +416,6 @@ public final class CQuery<T> implements DbReadContext, CancelableQuery, SpiProfi
|
||||
} else {
|
||||
// nextBean set to previously read currentBean
|
||||
nextBean = currentBean;
|
||||
request.persistenceContextAdd(nextBean);
|
||||
// check the current row we have just moved to
|
||||
if (checkForDifferentBean()) {
|
||||
return true;
|
||||
@@ -556,7 +552,7 @@ public final class CQuery<T> implements DbReadContext, CancelableQuery, SpiProfi
|
||||
}
|
||||
getTransaction().profileEvent(this);
|
||||
} catch (Exception e) {
|
||||
logger.error("Error updating execution statistics", e);
|
||||
CoreLog.log.error("Error updating execution statistics", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -185,7 +185,6 @@ final class CQueryBuilder {
|
||||
query.addSoftDeletePredicate(desc.softDeletePredicate(alias(query.getAlias())));
|
||||
}
|
||||
}
|
||||
|
||||
CQueryPredicates predicates = new CQueryPredicates(binder, request);
|
||||
CQueryPlan queryPlan = request.queryPlan();
|
||||
if (queryPlan != null) {
|
||||
@@ -195,7 +194,6 @@ final class CQueryBuilder {
|
||||
|
||||
// use RawSql or generated Sql
|
||||
predicates.prepare(true);
|
||||
|
||||
SqlTree sqlTree = createSqlTree(request, predicates);
|
||||
SqlLimitResponse s = buildSql(null, request, predicates, sqlTree);
|
||||
|
||||
@@ -260,14 +258,12 @@ final class CQueryBuilder {
|
||||
}
|
||||
|
||||
predicates.prepare(true);
|
||||
|
||||
SqlTree sqlTree = createSqlTree(request, predicates, selectCountWithColumnAlias && withAgg);
|
||||
if (SpiQuery.TemporalMode.CURRENT == query.getTemporalMode()) {
|
||||
sqlTree.addSoftDeletePredicate(query);
|
||||
}
|
||||
|
||||
boolean wrap = sqlTree.hasMany() || withAgg;
|
||||
|
||||
String sqlSelect = null;
|
||||
if (countDistinct) {
|
||||
if (sqlTree.isSingleProperty()) {
|
||||
@@ -279,11 +275,9 @@ final class CQueryBuilder {
|
||||
|
||||
SqlLimitResponse s = buildSql(sqlSelect, request, predicates, sqlTree);
|
||||
String sql = s.getSql();
|
||||
|
||||
if (!request.isInlineCountDistinct()) {
|
||||
if (countDistinct) {
|
||||
sql = wrapSelectCount(sql);
|
||||
|
||||
} else if (wrap || query.isRawSql()) {
|
||||
// remove order by - mssql does not accept order by in subqueries
|
||||
int pos = sql.lastIndexOf(" order by ");
|
||||
@@ -293,7 +287,6 @@ final class CQueryBuilder {
|
||||
sql = wrapSelectCount(sql);
|
||||
}
|
||||
}
|
||||
|
||||
// cache the query plan
|
||||
queryPlan = new CQueryPlan(request, sql, sqlTree, predicates.getLogWhereSql());
|
||||
request.putQueryPlan(queryPlan);
|
||||
@@ -330,18 +323,14 @@ final class CQueryBuilder {
|
||||
}
|
||||
|
||||
// RawSql or Generated Sql query
|
||||
|
||||
// Prepare the where, having and order by clauses.
|
||||
// This also parses them from logical property names to
|
||||
// database columns and determines 'includes'.
|
||||
|
||||
// We need to check these 'includes' for extra joins
|
||||
// that are not included via select
|
||||
predicates.prepare(true);
|
||||
|
||||
// Build the tree structure that represents the query.
|
||||
SpiQuery<T> query = request.query();
|
||||
|
||||
SqlTree sqlTree = createSqlTree(request, predicates);
|
||||
if (query.isAsOfQuery()) {
|
||||
sqlTree.addAsOfTableAlias(query);
|
||||
@@ -350,14 +339,12 @@ final class CQueryBuilder {
|
||||
}
|
||||
|
||||
SqlLimitResponse res = buildSql(null, request, predicates, sqlTree);
|
||||
|
||||
boolean rawSql = request.isRawSql();
|
||||
if (rawSql) {
|
||||
queryPlan = new CQueryPlanRawSql(request, res, sqlTree, predicates.getLogWhereSql());
|
||||
} else {
|
||||
queryPlan = new CQueryPlan(request, res, sqlTree, false, predicates.getLogWhereSql());
|
||||
}
|
||||
|
||||
BeanDescriptor<T> desc = request.descriptor();
|
||||
if (desc.isReadAuditing()) {
|
||||
// log the query plan based bean type (i.e. ignoring query disabling for logging the sql/plan)
|
||||
@@ -408,25 +395,22 @@ final class CQueryBuilder {
|
||||
sql = nativeQueryPaging(query, sql);
|
||||
}
|
||||
query.setGeneratedSql(sql);
|
||||
|
||||
Connection connection = request.transaction().connection();
|
||||
|
||||
BeanDescriptor<?> desc = request.descriptor();
|
||||
try {
|
||||
// For SqlServer we need either "selectMethod=cursor" in the connection string or fetch explicitly a cursorable
|
||||
// statement here by specifying ResultSet.CONCUR_UPDATABLE
|
||||
PreparedStatement statement = connection.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, dbPlatform.isSupportsResultSetConcurrencyModeUpdatable() ? ResultSet.CONCUR_UPDATABLE : ResultSet.CONCUR_READ_ONLY);
|
||||
predicates.bind(statement, connection);
|
||||
|
||||
ResultSet resultSet = statement.executeQuery();
|
||||
ResultSetMetaData metaData = resultSet.getMetaData();
|
||||
|
||||
int cols = 1 + metaData.getColumnCount();
|
||||
List<String> propertyNames = new ArrayList<>(cols - 1);
|
||||
for (int i = 1; i < cols; i++) {
|
||||
String schemaName = metaData.getSchemaName(i).toLowerCase();
|
||||
String tableName = metaData.getTableName(i).toLowerCase();
|
||||
String columnName = metaData.getColumnName(i).toLowerCase();
|
||||
String schemaName = lower(metaData.getSchemaName(i));
|
||||
String tableName = lower(metaData.getTableName(i));
|
||||
String columnName = lower(metaData.getColumnName(i));
|
||||
String path = desc.findBeanPath(schemaName, tableName, columnName);
|
||||
if (path != null) {
|
||||
propertyNames.add(path);
|
||||
@@ -434,16 +418,18 @@ final class CQueryBuilder {
|
||||
propertyNames.add(SpiRawSql.IGNORE_COLUMN);
|
||||
}
|
||||
}
|
||||
|
||||
RawSql rawSql = RawSqlBuilder.resultSet(resultSet, propertyNames.toArray(new String[0]));
|
||||
query.setRawSql(rawSql);
|
||||
return createRawSqlSqlTree(request, predicates);
|
||||
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private String lower(String value) {
|
||||
return value == null ? "" : value.toLowerCase();
|
||||
}
|
||||
|
||||
private SqlTree createRawSqlSqlTree(OrmQueryRequest<?> request, CQueryPredicates predicates) {
|
||||
BeanDescriptor<?> descriptor = request.descriptor();
|
||||
ColumnMapping columnMapping = request.query().getRawSql().getColumnMapping();
|
||||
@@ -597,7 +583,7 @@ final class CQueryBuilder {
|
||||
final OrderBy<?> orderBy = query.getOrderBy();
|
||||
if (orderBy != null && orderBy.supportsSelect()) {
|
||||
String trimmed = DbOrderByTrim.trim(dbOrderBy);
|
||||
if (query.isSingleAttribute() && trimmed.equals(select.getSelectSql())) {
|
||||
if (query.isSingleAttribute() && select.getSelectSql().startsWith(trimmed)) {
|
||||
// NOP, already in SQL
|
||||
// TODO: what to do if we select("id").orderBy("prop,id")?
|
||||
// Can we live with a query like "select t0.id, t0.prop, t0.id from"
|
||||
@@ -659,7 +645,6 @@ final class CQueryBuilder {
|
||||
private void appendFindId() {
|
||||
if (request.isFindById() || query.getId() != null) {
|
||||
appendAndOrWhere();
|
||||
|
||||
BeanDescriptor<?> desc = request.descriptor();
|
||||
String idSql = desc.idBinderIdSql(query.getAlias());
|
||||
if (idSql.isEmpty()) {
|
||||
@@ -670,7 +655,7 @@ final class CQueryBuilder {
|
||||
// strip the table alias for use in update statement
|
||||
idSql = idSql.replace("t0.", "");
|
||||
}
|
||||
sb.append(idSql).append(" ");
|
||||
sb.append(idSql);
|
||||
hasWhere = true;
|
||||
}
|
||||
}
|
||||
@@ -706,26 +691,21 @@ final class CQueryBuilder {
|
||||
if (!query.isIncludeSoftDeletes()) {
|
||||
appendSoftDelete();
|
||||
}
|
||||
|
||||
String groupBy = select.getGroupBy();
|
||||
if (groupBy != null) {
|
||||
sb.append(" group by ").append(groupBy);
|
||||
}
|
||||
|
||||
String dbHaving = predicates.getDbHaving();
|
||||
if (hasValue(dbHaving)) {
|
||||
sb.append(" having ").append(dbHaving);
|
||||
}
|
||||
|
||||
if (dbOrderBy != null && !query.isCountDistinct()) {
|
||||
sb.append(" order by ").append(dbOrderBy);
|
||||
}
|
||||
|
||||
if (countSingleAttribute) {
|
||||
sb.append(") r1 group by r1.attribute_");
|
||||
sb.append(toSql(query.getCountDistinctOrder()));
|
||||
}
|
||||
|
||||
if (useSqlLimiter) {
|
||||
// use LIMIT/OFFSET, ROW_NUMBER() or rownum type SQL query limitation
|
||||
SqlLimitRequest r = new OrmQueryLimitRequest(sb.toString(), dbOrderBy, query, dbPlatform, distinct);
|
||||
|
||||
@@ -60,7 +60,6 @@ final class CQueryBuilderRawSql {
|
||||
}
|
||||
|
||||
private String buildMainQuery(String orderBy, OrmQueryRequest<?> request, CQueryPredicates predicates, SpiRawSql.Sql sql) {
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(sql.getPreFrom());
|
||||
sb.append(" ");
|
||||
@@ -73,8 +72,7 @@ final class CQueryBuilderRawSql {
|
||||
// clause (so not allowed in having etc - use unparsed)
|
||||
s = BindParamsParser.parse(bindParams, s);
|
||||
}
|
||||
sb.append(s);
|
||||
sb.append(" ");
|
||||
sb.append(s).append(" ");
|
||||
|
||||
String dynamicWhere = null;
|
||||
if (request.query().getId() != null) {
|
||||
@@ -103,32 +101,26 @@ final class CQueryBuilderRawSql {
|
||||
} else {
|
||||
sb.append(" where ");
|
||||
}
|
||||
sb.append(dynamicWhere);
|
||||
sb.append(" ");
|
||||
sb.append(dynamicWhere).append(" ");
|
||||
}
|
||||
|
||||
String preHaving = sql.getPreHaving();
|
||||
if (hasValue(preHaving)) {
|
||||
sb.append(preHaving);
|
||||
sb.append(" ");
|
||||
sb.append(preHaving).append(" ");
|
||||
}
|
||||
|
||||
String dbHaving = predicates.getDbHaving();
|
||||
if (hasValue(dbHaving)) {
|
||||
sb.append(" ");
|
||||
if (sql.isAndHavingExpr()) {
|
||||
sb.append("and ");
|
||||
sb.append(" and ");
|
||||
} else {
|
||||
sb.append("having ");
|
||||
sb.append(" having ");
|
||||
}
|
||||
sb.append(dbHaving);
|
||||
sb.append(" ");
|
||||
sb.append(dbHaving).append(" ");
|
||||
}
|
||||
|
||||
if (hasValue(orderBy)) {
|
||||
sb.append(" ").append(sql.getOrderByPrefix()).append(" ").append(orderBy);
|
||||
}
|
||||
|
||||
return sb.toString().trim();
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.config.dbplatform.DatabasePlatform;
|
||||
import io.ebean.util.JdbcClose;
|
||||
import io.ebean.util.StringHelper;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.api.SpiQuery;
|
||||
import io.ebeaninternal.api.SpiTransaction;
|
||||
import io.ebeaninternal.server.core.DiffHelp;
|
||||
@@ -19,7 +20,6 @@ import io.ebeaninternal.server.deploy.BeanDescriptor;
|
||||
import io.ebeaninternal.server.util.Str;
|
||||
import io.ebeaninternal.server.persist.Binder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.sql.ResultSet;
|
||||
@@ -35,7 +35,7 @@ import java.util.Map;
|
||||
*/
|
||||
public final class CQueryEngine {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(CQueryEngine.class);
|
||||
private static final Logger log = CoreLog.log;
|
||||
|
||||
private static final String T0 = "t0";
|
||||
|
||||
@@ -191,7 +191,7 @@ public final class CQueryEngine {
|
||||
}
|
||||
if (!cquery.prepareBindExecuteQueryForwardOnly(forwardOnlyHintOnFindIterate)) {
|
||||
// query has been cancelled already
|
||||
logger.trace("Future fetch already cancelled");
|
||||
log.trace("Future fetch already cancelled");
|
||||
return null;
|
||||
}
|
||||
if (request.logSql()) {
|
||||
@@ -347,7 +347,7 @@ public final class CQueryEngine {
|
||||
}
|
||||
if (!cquery.prepareBindExecuteQuery()) {
|
||||
// query has been cancelled already
|
||||
logger.trace("Future fetch already cancelled");
|
||||
log.trace("Future fetch already cancelled");
|
||||
return null;
|
||||
}
|
||||
if (request.logSql()) {
|
||||
|
||||
+2
-5
@@ -4,14 +4,13 @@ import io.ebean.CancelableQuery;
|
||||
import io.ebean.CountedValue;
|
||||
import io.ebean.core.type.ScalarDataReader;
|
||||
import io.ebean.util.JdbcClose;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.api.SpiProfileTransactionEvent;
|
||||
import io.ebeaninternal.api.SpiQuery;
|
||||
import io.ebeaninternal.api.SpiTransaction;
|
||||
import io.ebeaninternal.server.core.OrmQueryRequest;
|
||||
import io.ebeaninternal.server.deploy.BeanDescriptor;
|
||||
import io.ebeaninternal.server.type.RsetDataReader;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
@@ -26,8 +25,6 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
*/
|
||||
final class CQueryFetchSingleAttribute implements SpiProfileTransactionEvent, CancelableQuery {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(CQueryFetchSingleAttribute.class);
|
||||
|
||||
private final CQueryPlan queryPlan;
|
||||
private final OrmQueryRequest<?> request;
|
||||
private final BeanDescriptor<?> desc;
|
||||
@@ -158,7 +155,7 @@ final class CQueryFetchSingleAttribute implements SpiProfileTransactionEvent, Ca
|
||||
dataReader = null;
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
logger.error("Error closing DataReader", e);
|
||||
CoreLog.log.error("Error closing DataReader", e);
|
||||
}
|
||||
JdbcClose.close(pstmt);
|
||||
pstmt = null;
|
||||
|
||||
@@ -6,21 +6,15 @@ import io.ebean.core.type.DataReader;
|
||||
import io.ebean.core.type.ScalarDataReader;
|
||||
import io.ebean.metric.MetricFactory;
|
||||
import io.ebean.metric.TimedMetric;
|
||||
import io.ebeaninternal.api.CQueryPlanKey;
|
||||
import io.ebeaninternal.api.SpiEbeanServer;
|
||||
import io.ebeaninternal.api.SpiQuery;
|
||||
import io.ebeaninternal.api.SpiQueryBindCapture;
|
||||
import io.ebeaninternal.api.SpiQueryPlan;
|
||||
import io.ebeaninternal.api.*;
|
||||
import io.ebeaninternal.server.core.OrmQueryRequest;
|
||||
import io.ebeaninternal.server.core.timezone.DataTimeZone;
|
||||
import io.ebeaninternal.server.util.Md5;
|
||||
import io.ebeaninternal.server.util.Str;
|
||||
import io.ebeaninternal.server.query.CQueryPlanStats.Snapshot;
|
||||
import io.ebeaninternal.server.type.DataBind;
|
||||
import io.ebeaninternal.server.type.DataBindCapture;
|
||||
import io.ebeaninternal.server.type.RsetDataReader;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import io.ebeaninternal.server.util.Md5;
|
||||
import io.ebeaninternal.server.util.Str;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
@@ -49,8 +43,6 @@ import java.util.Set;
|
||||
*/
|
||||
public class CQueryPlan implements SpiQueryPlan {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(CQueryPlan.class);
|
||||
|
||||
static final String RESULT_SET_BASED_RAW_SQL = "--ResultSetBasedRawSql";
|
||||
|
||||
private final SpiEbeanServer server;
|
||||
@@ -320,7 +312,7 @@ public class CQueryPlan implements SpiQueryPlan {
|
||||
predicates.bind(capture);
|
||||
bindCapture.setBind(capture.bindCapture(), executionTimeMicros, startNanos);
|
||||
} catch (SQLException e) {
|
||||
logger.error("Error capturing bind values", e);
|
||||
CoreLog.log.error("Error capturing bind values", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user