mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Compare commits
25
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 |
@@ -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")
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean api</name>
|
||||
|
||||
@@ -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>
|
||||
@@ -16,15 +16,22 @@ public class EbeanVersion {
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
log.info("ebean version: {}", version);
|
||||
@@ -33,6 +40,49 @@ public class EbeanVersion {
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
@@ -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,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.12.0</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.12.0</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.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -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>
|
||||
+15
-15
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.12.0</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.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-generator</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-externalmapping-api</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-externalmapping-xml</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-autotune</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>querybean-generator</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>kotlin-querybean-generator</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-postgis</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-redis</artifactId>
|
||||
<version>12.12.0</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>
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.12.0</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.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -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>
|
||||
+5
-5
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.12.0</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.12.0</tag>
|
||||
<tag>ebean-parent-12.12.2</tag>
|
||||
</scm>
|
||||
|
||||
<dependencies>
|
||||
@@ -41,19 +41,19 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-externalmapping-api</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -201,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.
|
||||
|
||||
@@ -118,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 {
|
||||
|
||||
@@ -416,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;
|
||||
|
||||
+5
-5
@@ -93,7 +93,7 @@ public final class DefaultPersistenceContext implements SpiPersistenceContext {
|
||||
lock.lock();
|
||||
try {
|
||||
putCount++;
|
||||
getClassContext(rootType).put(id, bean);
|
||||
classContext(rootType).put(id, bean);
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
@@ -104,7 +104,7 @@ public final class DefaultPersistenceContext implements SpiPersistenceContext {
|
||||
lock.lock();
|
||||
try {
|
||||
putCount++;
|
||||
return getClassContext(rootType).putIfAbsent(id, bean);
|
||||
return classContext(rootType).putIfAbsent(id, bean);
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
@@ -117,7 +117,7 @@ public final class DefaultPersistenceContext implements SpiPersistenceContext {
|
||||
public Object get(Class<?> rootType, Object id) {
|
||||
lock.lock();
|
||||
try {
|
||||
return getClassContext(rootType).get(id);
|
||||
return classContext(rootType).get(id);
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
@@ -127,7 +127,7 @@ public final class DefaultPersistenceContext implements SpiPersistenceContext {
|
||||
public WithOption getWithOption(Class<?> rootType, Object id) {
|
||||
lock.lock();
|
||||
try {
|
||||
return getClassContext(rootType).getWithOption(id);
|
||||
return classContext(rootType).getWithOption(id);
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
@@ -223,7 +223,7 @@ public final class DefaultPersistenceContext implements SpiPersistenceContext {
|
||||
}
|
||||
}
|
||||
|
||||
private ClassContext getClassContext(Class<?> rootType) {
|
||||
private ClassContext classContext(Class<?> rootType) {
|
||||
return typeCache.computeIfAbsent(rootType, k -> new ClassContext(rootType));
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,6 @@ public final class BindParamsParser {
|
||||
* </p>
|
||||
*/
|
||||
private String parseSql() {
|
||||
|
||||
if (params.isSameBindHash()) {
|
||||
String preparedSql = params.getPreparedSql();
|
||||
if (preparedSql != null && !preparedSql.isEmpty()) {
|
||||
@@ -68,114 +67,121 @@ public final class BindParamsParser {
|
||||
return preparedSql;
|
||||
}
|
||||
}
|
||||
String preparedSql = prepareSql();
|
||||
params.setPreparedSql(preparedSql);
|
||||
params.updateHash();
|
||||
return preparedSql;
|
||||
}
|
||||
|
||||
String preparedSql;
|
||||
if (params.requiresNamedParamsPrepare()) {
|
||||
private String prepareSql() {
|
||||
if (!params.requiresNamedParamsPrepare()) {
|
||||
return sql;
|
||||
} else {
|
||||
// convert named parameters into ordered list
|
||||
OrderedList orderedList = params.createOrderedList();
|
||||
parseNamedParams(orderedList);
|
||||
preparedSql = orderedList.getPreparedSql();
|
||||
} else {
|
||||
preparedSql = sql;
|
||||
return orderedList.getPreparedSql();
|
||||
}
|
||||
params.setPreparedSql(preparedSql);
|
||||
return preparedSql;
|
||||
}
|
||||
|
||||
/**
|
||||
* Named parameters need to be parsed and replaced with ?.
|
||||
*/
|
||||
private void parseNamedParams(OrderedList orderedList) {
|
||||
|
||||
parseNamedParams(0, orderedList);
|
||||
}
|
||||
|
||||
private void parseNamedParams(int startPos, OrderedList orderedList) {
|
||||
|
||||
if (sql == null) {
|
||||
throw new PersistenceException("query does not contain any named bind parameters?");
|
||||
}
|
||||
if (startPos > sql.length()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// search for quotes and named params... in order...
|
||||
// search for quotes and named params in order
|
||||
int beginQuotePos = sql.indexOf(quote, startPos);
|
||||
int nameParamStart = findNameStart(sql, startPos);
|
||||
if (beginQuotePos > 0 && beginQuotePos < nameParamStart) {
|
||||
// the quote precedes the named parameter...
|
||||
// find and add up to the end quote
|
||||
int endQuotePos = sql.indexOf(quote, beginQuotePos + 1);
|
||||
String sub = sql.substring(startPos, endQuotePos + 1);
|
||||
orderedList.appendSql(sub);
|
||||
|
||||
// start again after the end quote
|
||||
parseNamedParams(endQuotePos + 1, orderedList);
|
||||
addNamedParam(startPos, orderedList, beginQuotePos);
|
||||
|
||||
} else {
|
||||
if (nameParamStart < 0) {
|
||||
// no more params, add the rest
|
||||
String sub = sql.substring(startPos, sql.length());
|
||||
orderedList.appendSql(sub);
|
||||
orderedList.appendSql(sql.substring(startPos));
|
||||
|
||||
} else {
|
||||
// find the end of the parameter name
|
||||
int endOfParam = nameParamStart + 1;
|
||||
do {
|
||||
char c = sql.charAt(endOfParam);
|
||||
if (c != '_' && !Character.isLetterOrDigit(c)) {
|
||||
break;
|
||||
}
|
||||
endOfParam++;
|
||||
} while (endOfParam < sql.length());
|
||||
|
||||
int endOfParam = findEndOfParam(nameParamStart);
|
||||
// add the named parameter value to bindList
|
||||
String paramName = sql.substring(nameParamStart + 1, endOfParam);
|
||||
Param param = extractNamedParam(paramName);
|
||||
|
||||
Param param;
|
||||
if (paramName.startsWith(ENCRYPTKEY_PREFIX)) {
|
||||
param = addEncryptKeyParam(paramName);
|
||||
} else {
|
||||
param = params.getParameter(paramName);
|
||||
}
|
||||
|
||||
if (param == null) {
|
||||
String msg = "Bind value is not set or null for [" + paramName + "] in [" + sql + "]";
|
||||
throw new PersistenceException(msg);
|
||||
}
|
||||
|
||||
String sub = sql.substring(startPos, nameParamStart);
|
||||
orderedList.appendSql(sub);
|
||||
|
||||
// check if inValue is a Collection type...
|
||||
orderedList.appendSql(sql.substring(startPos, nameParamStart));
|
||||
Object inValue = param.getInValue();
|
||||
if (inValue instanceof Collection<?>) {
|
||||
// Chop up Collection parameter into a number
|
||||
// of individual parameters and add each one individually
|
||||
Collection<?> collection = (Collection<?>) inValue;
|
||||
int c = 0;
|
||||
for (Object elVal : collection) {
|
||||
if (++c > 1) {
|
||||
orderedList.appendSql(",");
|
||||
}
|
||||
orderedList.appendSql("?");
|
||||
BindParams.Param elParam = new BindParams.Param();
|
||||
elParam.setInValue(elVal);
|
||||
orderedList.add(elParam);
|
||||
}
|
||||
|
||||
addCollectionParams(orderedList, param, (Collection<?>) inValue);
|
||||
} else {
|
||||
// its a normal scalar value parameter...
|
||||
orderedList.add(param);
|
||||
orderedList.appendSql("?");
|
||||
addScalarParam(orderedList, param);
|
||||
}
|
||||
|
||||
// continue on after the end of the parameter
|
||||
parseNamedParams(endOfParam, orderedList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addScalarParam(OrderedList orderedList, Param param) {
|
||||
orderedList.add(param);
|
||||
orderedList.appendSql("?");
|
||||
}
|
||||
|
||||
private Param extractNamedParam(String paramName) {
|
||||
Param param;
|
||||
if (paramName.startsWith(ENCRYPTKEY_PREFIX)) {
|
||||
param = addEncryptKeyParam(paramName);
|
||||
} else {
|
||||
param = params.getParameter(paramName);
|
||||
}
|
||||
if (param == null) {
|
||||
throw new PersistenceException("Bind value is not set or null for [" + paramName + "] in [" + sql + "]");
|
||||
}
|
||||
return param;
|
||||
}
|
||||
|
||||
private int findEndOfParam(int nameParamStart) {
|
||||
int endOfParam = nameParamStart + 1;
|
||||
do {
|
||||
char c = sql.charAt(endOfParam);
|
||||
if (c != '_' && !Character.isLetterOrDigit(c)) {
|
||||
break;
|
||||
}
|
||||
endOfParam++;
|
||||
} while (endOfParam < sql.length());
|
||||
return endOfParam;
|
||||
}
|
||||
|
||||
private void addNamedParam(int startPos, OrderedList orderedList, int beginQuotePos) {
|
||||
// the quote precedes the named parameter...
|
||||
// find and add up to the end quote
|
||||
int endQuotePos = sql.indexOf(quote, beginQuotePos + 1);
|
||||
String sub = sql.substring(startPos, endQuotePos + 1);
|
||||
orderedList.appendSql(sub);
|
||||
|
||||
// start again after the end quote
|
||||
parseNamedParams(endQuotePos + 1, orderedList);
|
||||
}
|
||||
|
||||
private void addCollectionParams(OrderedList orderedList, Param param, Collection<?> inValue) {
|
||||
// Chop up Collection parameter into a number of individual parameters
|
||||
Collection<?> collection = inValue;
|
||||
for (int c = 0; c < collection.size(); c++) {
|
||||
if (c > 0) {
|
||||
orderedList.appendSql(",");
|
||||
}
|
||||
orderedList.appendSql("?");
|
||||
}
|
||||
orderedList.add(param);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the next named parameter start position (based on colon).
|
||||
*/
|
||||
@@ -200,15 +206,11 @@ public final class BindParamsParser {
|
||||
* Add an encryption key bind parameter.
|
||||
*/
|
||||
private Param addEncryptKeyParam(String keyNamedParam) {
|
||||
|
||||
int pos = keyNamedParam.indexOf(ENCRYPTKEY_GAP, ENCRYPTKEY_PREFIX_LEN);
|
||||
|
||||
String tableName = keyNamedParam.substring(ENCRYPTKEY_PREFIX_LEN, pos);
|
||||
String columnName = keyNamedParam.substring(pos + ENCRYPTKEY_GAP_LEN);
|
||||
|
||||
EncryptKey key = beanDescriptor.encryptKey(tableName, columnName);
|
||||
String strKey = key.getStringValue();
|
||||
|
||||
return params.setEncryptionKey(keyNamedParam, strKey);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean ddl generation</name>
|
||||
@@ -28,14 +28,14 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
<?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 ddl generation</name>
|
||||
<description>DDL and DB Migration generation</description>
|
||||
<artifactId>ebean-ddl-generator</artifactId>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-runner</artifactId>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-migration</artifactId>
|
||||
<version>12.12.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<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>
|
||||
|
||||
<!-- test dependencies -->
|
||||
<dependency>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-datasource</artifactId>
|
||||
<version>${ebean-datasource.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
<version>2.0.1.Final</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>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>
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean external mapping api</name>
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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 external mapping api</name>
|
||||
<description>API for mapping external named queries</description>
|
||||
<artifactId>ebean-externalmapping-api</artifactId>
|
||||
|
||||
<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>
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.12.0</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.12.0</tag>
|
||||
<tag>ebean-parent-12.12.2</tag>
|
||||
</scm>
|
||||
|
||||
<name>ebean external mapping xml</name>
|
||||
@@ -33,7 +33,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-externalmapping-api</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -59,14 +59,14 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-generator</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
<?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 external mapping xml</name>
|
||||
<description>XML implementation for mapping external named queries</description>
|
||||
<artifactId>ebean-externalmapping-xml</artifactId>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.30</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-externalmapping-api</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>jaxb-runtime</artifactId>
|
||||
<version>2.3.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>classpath-scanner</artifactId>
|
||||
<version>6.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- test dependencies -->
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-datasource</artifactId>
|
||||
<version>${ebean-datasource.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-generator</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</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>
|
||||
<!-- other 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>
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean postgis</name>
|
||||
@@ -23,7 +23,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
<?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 postgis</name>
|
||||
<description>ebean postgis module</description>
|
||||
<url>https://ebean.io/</url>
|
||||
|
||||
<artifactId>ebean-postgis</artifactId>
|
||||
|
||||
<properties>
|
||||
<postgis.jdbc.version>2.2.1</postgis.jdbc.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- provided scope -->
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.postgis</groupId>
|
||||
<artifactId>postgis-jdbc</artifactId>
|
||||
<version>[${postgis.jdbc.version}]</version>
|
||||
</dependency>
|
||||
|
||||
<!-- expected to be provided -->
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>42.2.8</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- expected to be provided -->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.30</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- optionally use geolatte-geom -->
|
||||
<dependency>
|
||||
<groupId>org.geolatte</groupId>
|
||||
<artifactId>geolatte-geom</artifactId>
|
||||
<version>1.0.6</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.ebean</groupId>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.avaje.composite</groupId>
|
||||
<artifactId>logback</artifactId>
|
||||
<version>1.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
<!-- for testing -->
|
||||
<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>
|
||||
+5
-13
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean querybean</name>
|
||||
@@ -17,7 +17,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -57,21 +57,21 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-generator</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>querybean-generator</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -93,14 +93,6 @@
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<argLine>
|
||||
--add-opens io.ebean.querybean/org.querytest=io.ebean.core
|
||||
</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- Enhancement -->
|
||||
<plugin>
|
||||
<groupId>io.repaint.maven</groupId>
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
<?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 querybean</name>
|
||||
<description>Ebean querybean support</description>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- provided scope -->
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</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>joda-time</groupId>
|
||||
<artifactId>joda-time</artifactId>
|
||||
<version>1.6</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
<version>2.0.1.Final</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- test dependencies -->
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-datasource</artifactId>
|
||||
<version>${ebean-datasource.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-generator</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>querybean-generator</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.avaje.composite</groupId>
|
||||
<artifactId>logback</artifactId>
|
||||
<version>1.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- Enhancement -->
|
||||
<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>
|
||||
+6
-6
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ebean-redis</artifactId>
|
||||
@@ -22,35 +22,35 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>querybean-generator</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
<?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-redis</artifactId>
|
||||
<name>ebean redis</name>
|
||||
<description>Ebean Redis L2 Cache</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>querybean-generator</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.avaje.composite</groupId>
|
||||
<artifactId>logback</artifactId>
|
||||
<version>1.1</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>
|
||||
|
||||
+3
-3
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean test</name>
|
||||
@@ -29,14 +29,14 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-generator</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -0,0 +1,245 @@
|
||||
<?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 test</name>
|
||||
<description>Testing support for Ebean</description>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.30</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-datasource</artifactId>
|
||||
<version>${ebean-datasource.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-generator</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test-docker</artifactId>
|
||||
<version>4.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.assertj</groupId>
|
||||
<artifactId>assertj-core</artifactId>
|
||||
<version>3.14.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Including JAXB for DB Migration generation with Java 11+ -->
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>jaxb-runtime</artifactId>
|
||||
<version>2.3.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Not strictly required but bring in H2 Driver because we use it so much -->
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<version>1.4.199</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Test dependencies -->
|
||||
|
||||
<dependency>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>avaje-jsr305</artifactId>
|
||||
<version>1.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-migration</artifactId>
|
||||
<version>12.12.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>mod-uuid</artifactId>
|
||||
<version>1.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.transaction</groupId>
|
||||
<artifactId>jta</artifactId>
|
||||
<version>1.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- validation annotations Size etc -->
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
<version>2.0.1.Final</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jakarta.validation</groupId>
|
||||
<artifactId>jakarta.validation-api</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>joda-time</groupId>
|
||||
<artifactId>joda-time</artifactId>
|
||||
<version>2.9.7</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.annotation</groupId>
|
||||
<artifactId>javax.annotation-api</artifactId>
|
||||
<version>1.3.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.7</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>42.2.23</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.checkerframework</groupId>
|
||||
<artifactId>checker-qual</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.microsoft.sqlserver</groupId>
|
||||
<artifactId>mssql-jdbc</artifactId>
|
||||
<version>9.4.0.jre8</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.26</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mariadb.jdbc</groupId>
|
||||
<artifactId>mariadb-java-client</artifactId>
|
||||
<version>2.6.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.sap.cloud.db.jdbc</groupId>
|
||||
<artifactId>ngdbc</artifactId>
|
||||
<version>2.3.48</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.oracle.database.jdbc</groupId>
|
||||
<artifactId>ojdbc10</artifactId>
|
||||
<version>19.12.0.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>1.2.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>db2</id>
|
||||
<dependencies>
|
||||
<!-- https://mvnrepository.com/artifact/com.ibm.db2/jcc -->
|
||||
<dependency>
|
||||
<groupId>com.ibm.db2</groupId>
|
||||
<artifactId>jcc</artifactId>
|
||||
<version>11.5.5.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<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>
|
||||
@@ -19,17 +19,19 @@ public class BindParamsTest {
|
||||
BindParams.Param param = bindParams.getParameter("ids");
|
||||
assertEquals(3, param.queryBindCount());
|
||||
assertFalse(bindParams.isSameBindHash());
|
||||
bindParams.updateHash();
|
||||
|
||||
List<String> ids2 = Arrays.asList("1", "2", "3", "4");
|
||||
bindParams.setParameter("ids", ids2);
|
||||
assertEquals(4, param.queryBindCount());
|
||||
assertFalse(bindParams.isSameBindHash());
|
||||
bindParams.updateHash();
|
||||
|
||||
List<String> ids3 = Arrays.asList("2", "99", "44");
|
||||
bindParams.setParameter("ids", ids3);
|
||||
assertEquals(3, param.queryBindCount());
|
||||
assertFalse(bindParams.isSameBindHash());
|
||||
|
||||
bindParams.updateHash();
|
||||
|
||||
List<String> ids4 = Arrays.asList("4545", "3499", "3444");
|
||||
bindParams.setParameter("ids", ids4);
|
||||
|
||||
@@ -2,11 +2,15 @@ package org.tests.basic;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.DB;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.tests.model.basic.Customer;
|
||||
import org.tests.model.basic.Order;
|
||||
import org.tests.model.basic.ResetBasicData;
|
||||
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
@@ -78,4 +82,36 @@ public class TestPersistenceContext extends BaseTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
@Disabled
|
||||
@Test
|
||||
void findWithGcTest() {
|
||||
for (int j = 0; j < 20; j++) {
|
||||
for (int i = 0; i < 500; i++) {
|
||||
Customer c = new Customer();
|
||||
c.setName("Customer #" + i);
|
||||
DB.save(c);
|
||||
}
|
||||
int customerCount = DB.find(Customer.class).findCount();
|
||||
AtomicInteger count = new AtomicInteger(customerCount);
|
||||
|
||||
WeakHashMap<Customer, Integer> customers = new WeakHashMap<>();
|
||||
|
||||
DB.find(Customer.class).fetch("orders").findEach(customer -> {
|
||||
customers.put(customer, customer.getId());
|
||||
if (count.decrementAndGet() == 0) {
|
||||
// Trigger garbage collection on last iteration and check if beans disappear from memory
|
||||
System.gc();
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
e.printStackTrace();
|
||||
}
|
||||
customers.size(); // expunge stale entries
|
||||
System.out.println("Total instances: " + customerCount + ", instances left in memory: " + customers.size());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package org.tests.basic;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.DB;
|
||||
import io.ebean.Update;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.tests.model.basic.Customer;
|
||||
import org.tests.model.basic.ResetBasicData;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Testcase identified a bug when collections are used as bind parameters
|
||||
*
|
||||
* @author Roland Praml, FOCONIS AG
|
||||
*/
|
||||
public class TestUpdate extends BaseTestCase {
|
||||
|
||||
@BeforeEach
|
||||
public void createCustomers() {
|
||||
ResetBasicData.reset();
|
||||
for (int i = 1; i <= 3; i++) {
|
||||
Customer cust = new Customer();
|
||||
cust.setName("testUpdate" + i);
|
||||
DB.save(cust);
|
||||
}
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void deleteCustomers() {
|
||||
DB.createUpdate(Customer.class, "delete from customer where name like 'testUpdate%'").execute();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNormal() {
|
||||
for (int i = 1; i <= 3; i++) {
|
||||
Update<Customer> update = DB.createUpdate(Customer.class,
|
||||
"update customer set smallnote = :smallnote where name in (:name)");
|
||||
update.setParameter("name", Arrays.asList("testUpdate" + i)).setParameter("smallnote", "Note #" + i).execute();
|
||||
}
|
||||
Customer cust = DB.find(Customer.class).where().eq("name", "testUpdate3").findOne();
|
||||
assertThat(cust.getSmallnote()).isEqualTo("Note #3");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReuse() {
|
||||
Update<Customer> update = DB.createUpdate(Customer.class,
|
||||
"update customer set smallnote = :smallnote where name in (:name)");
|
||||
for (int i = 1; i <= 3; i++) {
|
||||
update.setParameter("name", Arrays.asList("testUpdate" + i)).setParameter("smallnote", "Note #" + i).execute();
|
||||
}
|
||||
Customer cust = DB.find(Customer.class).where().eq("name", "testUpdate3").findOne();
|
||||
assertThat(cust.getSmallnote()).isEqualTo("Note #3");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReuseNoArray() {
|
||||
Update<Customer> update = DB.createUpdate(Customer.class,
|
||||
"update customer set smallnote = :smallnote where name = :name");
|
||||
for (int i = 1; i <= 3; i++) {
|
||||
update.setParameter("name", "testUpdate" + i).setParameter("smallnote", "Note #" + i).execute();
|
||||
}
|
||||
Customer cust = DB.find(Customer.class).where().eq("name", "testUpdate3").findOne();
|
||||
assertThat(cust.getSmallnote()).isEqualTo("Note #3");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package org.tests.o2m;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.common.BeanList;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.tests.model.json.EBasicJsonMap;
|
||||
import org.tests.o2m.lazy.OmlBaz;
|
||||
import org.tests.o2m.lazy.OmlFoo;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class TestOneToManyEnhancement extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
void test_when_constructorAddsEntry() {
|
||||
OmlFoo foo = new OmlFoo(new OmlBaz());
|
||||
|
||||
assertThat(foo.getBazList()).isInstanceOf(BeanList.class);
|
||||
assertThat(foo.getBazList()).isNotEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
void test_commonCase() {
|
||||
EBasicJsonMap bean = new EBasicJsonMap();
|
||||
|
||||
assertThat(bean.getDetails()).isInstanceOf(BeanList.class);
|
||||
assertThat(bean.getDetails()).isEmpty();
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,12 @@ public class OmlFoo {
|
||||
private OmlBar bar;
|
||||
|
||||
@OneToMany(mappedBy = "foo", cascade = CascadeType.ALL)
|
||||
private List<OmlBaz> bazList = new ArrayList<OmlBaz>();
|
||||
private List<OmlBaz> bazList = new ArrayList<>();
|
||||
|
||||
public OmlFoo(OmlBaz baz) {
|
||||
bazList.add(baz);
|
||||
baz.setFoo(this);
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
|
||||
@@ -13,11 +13,9 @@ public class TestLazyManyViaPath extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
|
||||
OmlBar bar = new OmlBar();
|
||||
List<OmlFoo> fooList = new ArrayList<>();
|
||||
fooList.add(createNewFooWithBar(bar));
|
||||
|
||||
bar.setFooList(fooList);
|
||||
|
||||
DB.save(bar);
|
||||
@@ -30,26 +28,24 @@ public class TestLazyManyViaPath extends BaseTestCase {
|
||||
|
||||
// This works
|
||||
List<OmlFoo> foosList = fooFromDb.getBar().getFooList();
|
||||
assertThat(fooList.size()).isEqualTo(1);
|
||||
assertThat(foosList).hasSize(1);
|
||||
assertThat(fooList).hasSize(1);
|
||||
|
||||
OmlBaz bazFromDb = DB
|
||||
.find(OmlBaz.class)
|
||||
.where()
|
||||
.eq("id", bar.getFooList().get(0).getBazList().get(0).getId())
|
||||
.findOne();
|
||||
assert bazFromDb != null;
|
||||
|
||||
// This does not work and gives the exception
|
||||
List<OmlFoo> foosList1 = bazFromDb.getFoo().getBar().getFooList();
|
||||
assertThat(foosList1.size()).isEqualTo(1);
|
||||
|
||||
}
|
||||
|
||||
private static OmlFoo createNewFooWithBar(OmlBar bar) {
|
||||
OmlFoo foo = new OmlFoo();
|
||||
OmlFoo foo = new OmlFoo(new OmlBaz());
|
||||
foo.setBar(bar);
|
||||
OmlBaz baz = new OmlBaz();
|
||||
baz.setFoo(foo);
|
||||
foo.getBazList().add(baz);
|
||||
return foo;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,17 +12,16 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class TestOneToManyCorrectGrouping extends BaseTestCase {
|
||||
class TestOneToManyCorrectGrouping extends BaseTestCase {
|
||||
|
||||
public static final int EXPECTED_ITERATIONS = 2;
|
||||
static final int EXPECTED_ITERATIONS = 4;
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
|
||||
void test() {
|
||||
ResetBasicData.reset();
|
||||
Query<Customer> customerQuery = DB.find(Customer.class)
|
||||
.fetch("orders")
|
||||
.where().le("id", 2)
|
||||
.where().le("id", 4)
|
||||
.query();
|
||||
|
||||
final AtomicInteger count = new AtomicInteger();
|
||||
|
||||
+4
-4
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean composite</name>
|
||||
@@ -22,20 +22,20 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Technically optional but most expected to use query beans -->
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
<?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 composite</name>
|
||||
<description>Composite of common runtime dependencies</description>
|
||||
<artifactId>ebean</artifactId>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-datasource</artifactId>
|
||||
<version>${ebean-datasource.version}</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>
|
||||
|
||||
<!-- Technically optional but most expected to use query beans -->
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
</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,7 @@
|
||||
package io.ebean.assembly;
|
||||
|
||||
/**
|
||||
* Nothing interesting here - look at ebean-api.
|
||||
*/
|
||||
public class Assembly {
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
</parent>
|
||||
|
||||
<name>kotlin querybean generator</name>
|
||||
@@ -29,7 +29,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-generator</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
+21
-4
@@ -6,6 +6,7 @@ import javax.annotation.processing.RoundEnvironment;
|
||||
import javax.lang.model.SourceVersion;
|
||||
import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -18,6 +19,7 @@ public class Processor extends AbstractProcessor implements Constants {
|
||||
private static final String KAPT_KOTLIN_GENERATED_OPTION = "kapt.kotlin.generated";
|
||||
|
||||
private ProcessingContext processingContext;
|
||||
private SimpleModuleInfoWriter moduleWriter;
|
||||
|
||||
public Processor() {
|
||||
}
|
||||
@@ -55,11 +57,11 @@ public class Processor extends AbstractProcessor implements Constants {
|
||||
|
||||
@Override
|
||||
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
|
||||
|
||||
processingContext.readModuleInfo();
|
||||
int count = processEntities(roundEnv);
|
||||
processOthers(roundEnv);
|
||||
final int loaded = processingContext.complete();
|
||||
initModuleInfoBean();
|
||||
if (roundEnv.processingOver()) {
|
||||
writeModuleInfoBean();
|
||||
}
|
||||
@@ -96,12 +98,27 @@ public class Processor extends AbstractProcessor implements Constants {
|
||||
}
|
||||
}
|
||||
|
||||
private void initModuleInfoBean() {
|
||||
try {
|
||||
if (moduleWriter == null) {
|
||||
moduleWriter = new SimpleModuleInfoWriter(processingContext);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
processingContext.logError(null, "Failed to initialise ModuleInfoLoader error:" + e + " stack:" + Arrays.toString(e.getStackTrace()));
|
||||
}
|
||||
}
|
||||
|
||||
private void writeModuleInfoBean() {
|
||||
try {
|
||||
SimpleModuleInfoWriter writer = new SimpleModuleInfoWriter(processingContext);
|
||||
writer.write();
|
||||
if (moduleWriter == null) {
|
||||
processingContext.logError(null, "ModuleInfoLoader was not initialised and not written");
|
||||
} else {
|
||||
moduleWriter.write();
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
processingContext.logError(null, "Failed to write ModuleInfoLoader " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
processingContext.logError(null, "Failed to write ModuleInfoLoader error:" + e + " stack:" + Arrays.toString(e.getStackTrace()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-3
@@ -18,14 +18,16 @@ class SimpleModuleInfoWriter {
|
||||
private final String factoryPackage;
|
||||
private final String factoryShortName;
|
||||
private final String factoryFullName;
|
||||
private final JavaFileObject javaFileObject;
|
||||
|
||||
private Append writer;
|
||||
|
||||
SimpleModuleInfoWriter(ProcessingContext processingContext) {
|
||||
SimpleModuleInfoWriter(ProcessingContext processingContext) throws IOException {
|
||||
this.processingContext = processingContext;
|
||||
this.factoryPackage = processingContext.getFactoryPackage();
|
||||
this.factoryShortName = "_Ebean$ModuleInfo";
|
||||
this.factoryFullName = factoryPackage + "." + factoryShortName;
|
||||
this.javaFileObject = processingContext.createWriter(factoryFullName);
|
||||
}
|
||||
|
||||
void write() throws IOException {
|
||||
@@ -208,7 +210,6 @@ class SimpleModuleInfoWriter {
|
||||
}
|
||||
|
||||
private Writer createFileWriter() throws IOException {
|
||||
JavaFileObject jfo = processingContext.createWriter(factoryFullName);
|
||||
return jfo.openWriter();
|
||||
return javaFileObject.openWriter();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>ebean parent</name>
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
<scm>
|
||||
<developerConnection>scm:git:git@github.com:ebean-orm/ebean.git</developerConnection>
|
||||
<tag>ebean-parent-12.12.0</tag>
|
||||
<tag>ebean-parent-12.12.2</tag>
|
||||
</scm>
|
||||
|
||||
<licenses>
|
||||
@@ -45,8 +45,8 @@
|
||||
<ebean-migration.version>12.12.1</ebean-migration.version>
|
||||
<ebean-test-docker.version>4.2</ebean-test-docker.version>
|
||||
<ebean-datasource.version>7.3</ebean-datasource.version>
|
||||
<ebean-agent.version>12.12.0</ebean-agent.version>
|
||||
<ebean-maven-plugin.version>12.12.0</ebean-maven-plugin.version>
|
||||
<ebean-agent.version>12.12.2</ebean-agent.version>
|
||||
<ebean-maven-plugin.version>12.12.2</ebean-maven-plugin.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
<?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>
|
||||
<groupId>org.avaje</groupId>
|
||||
<artifactId>java8-oss</artifactId>
|
||||
<version>3.2</version>
|
||||
</parent>
|
||||
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<version>12.12.2-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>ebean parent</name>
|
||||
<description>Parent for ebean modules</description>
|
||||
<url>https://ebean.io/</url>
|
||||
|
||||
<scm>
|
||||
<developerConnection>scm:git:git@github.com:ebean-orm/ebean.git</developerConnection>
|
||||
<tag>HEAD</tag>
|
||||
</scm>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>The Apache Software License, Version 2.0</name>
|
||||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
||||
<distribution>repo</distribution>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<id>rbygrave</id>
|
||||
<name>Rob Bygrave</name>
|
||||
<email>robin.bygrave@gmail.com</email>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<properties>
|
||||
<nexus.staging.autoReleaseAfterClose>true</nexus.staging.autoReleaseAfterClose>
|
||||
<jackson.version>2.12.1</jackson.version>
|
||||
<ebean-ddl-runner.version>1.2</ebean-ddl-runner.version>
|
||||
<ebean-migration-auto.version>1.1</ebean-migration-auto.version>
|
||||
<ebean-migration.version>12.12.1</ebean-migration.version>
|
||||
<ebean-test-docker.version>4.2</ebean-test-docker.version>
|
||||
<ebean-datasource.version>7.3</ebean-datasource.version>
|
||||
<ebean-agent.version>12.12.2</ebean-agent.version>
|
||||
<ebean-maven-plugin.version>12.12.2</ebean-maven-plugin.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.30</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>1.2.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<version>1.4.199</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<modules>
|
||||
<module>ebean</module>
|
||||
<module>ebean-api</module>
|
||||
<module>ebean-bom</module>
|
||||
<module>ebean-core-type</module>
|
||||
<module>ebean-core</module>
|
||||
<module>ebean-ddl-generator</module>
|
||||
<module>ebean-autotune</module>
|
||||
<module>ebean-externalmapping-api</module>
|
||||
<module>ebean-externalmapping-xml</module>
|
||||
<module>ebean-test</module>
|
||||
<module>querybean-generator</module>
|
||||
<module>kotlin-querybean-generator</module>
|
||||
<module>ebean-querybean</module>
|
||||
<module>ebean-postgis</module>
|
||||
<module>ebean-redis</module>
|
||||
<!-- <module>tests</module>-->
|
||||
</modules>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.12.0</version>
|
||||
<version>12.12.2</version>
|
||||
</parent>
|
||||
|
||||
<name>querybean generator</name>
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
<?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>querybean generator</name>
|
||||
<description>Querybean generator</description>
|
||||
<artifactId>querybean-generator</artifactId>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.2</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<!-- Turn off annotation processing for building -->
|
||||
<compilerArgument>-proc:none</compilerArgument>
|
||||
</configuration>
|
||||
</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>
|
||||
@@ -16,6 +16,7 @@ import java.util.Set;
|
||||
public class Processor extends AbstractProcessor implements Constants {
|
||||
|
||||
private ProcessingContext processingContext;
|
||||
private SimpleModuleInfoWriter moduleWriter;
|
||||
|
||||
public Processor() {
|
||||
}
|
||||
@@ -48,6 +49,7 @@ public class Processor extends AbstractProcessor implements Constants {
|
||||
int count = processEntities(roundEnv);
|
||||
processOthers(roundEnv);
|
||||
final int loaded = processingContext.complete();
|
||||
initModuleInfoBean();
|
||||
if (roundEnv.processingOver()) {
|
||||
writeModuleInfoBean();
|
||||
}
|
||||
@@ -84,10 +86,24 @@ public class Processor extends AbstractProcessor implements Constants {
|
||||
}
|
||||
}
|
||||
|
||||
private void initModuleInfoBean() {
|
||||
try {
|
||||
if (moduleWriter == null) {
|
||||
moduleWriter = new SimpleModuleInfoWriter(processingContext);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
processingContext.logError(null, "Failed to initialise ModuleInfoLoader error:" + e + " stack:" + Arrays.toString(e.getStackTrace()));
|
||||
}
|
||||
}
|
||||
|
||||
private void writeModuleInfoBean() {
|
||||
try {
|
||||
SimpleModuleInfoWriter writer = new SimpleModuleInfoWriter(processingContext);
|
||||
writer.write();
|
||||
if (moduleWriter == null) {
|
||||
processingContext.logError(null, "ModuleInfoLoader was not initialised and not written");
|
||||
} else {
|
||||
moduleWriter.write();
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
processingContext.logError(null, "Failed to write ModuleInfoLoader error:" + e + " stack:" + Arrays.toString(e.getStackTrace()));
|
||||
|
||||
+4
-3
@@ -18,14 +18,16 @@ class SimpleModuleInfoWriter {
|
||||
private final String factoryPackage;
|
||||
private final String factoryShortName;
|
||||
private final String factoryFullName;
|
||||
private final JavaFileObject javaFileObject;
|
||||
|
||||
private Append writer;
|
||||
|
||||
SimpleModuleInfoWriter(ProcessingContext processingContext) {
|
||||
SimpleModuleInfoWriter(ProcessingContext processingContext) throws IOException {
|
||||
this.processingContext = processingContext;
|
||||
this.factoryPackage = processingContext.getFactoryPackage();
|
||||
this.factoryShortName = "_Ebean$ModuleInfo";
|
||||
this.factoryFullName = factoryPackage + "." + factoryShortName;
|
||||
this.javaFileObject = processingContext.createWriter(factoryFullName);
|
||||
}
|
||||
|
||||
void write() throws IOException {
|
||||
@@ -208,7 +210,6 @@ class SimpleModuleInfoWriter {
|
||||
}
|
||||
|
||||
private Writer createFileWriter() throws IOException {
|
||||
JavaFileObject jfo = processingContext.createWriter(factoryFullName);
|
||||
return jfo.openWriter();
|
||||
return javaFileObject.openWriter();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
#release configuration
|
||||
#Tue Oct 12 12:43:59 NZDT 2021
|
||||
projectVersionPolicyId=default
|
||||
project.scm.io.ebean\:ebean-core-type.tag=HEAD
|
||||
scm.branchCommitComment=@{prefix} prepare branch @{releaseLabel}
|
||||
project.rel.io.ebean\:ebean-ddl-generator=12.12.2
|
||||
project.dev.io.ebean\:ebean-core=12.12.3-SNAPSHOT
|
||||
project.scm.io.ebean\:ebean-api.tag=HEAD
|
||||
project.scm.io.ebean\:ebean-redis.developerConnection=scm\:git\:git@github.com\:ebean-orm/ebean.git
|
||||
project.scm.io.ebean\:ebean-querybean.tag=HEAD
|
||||
project.scm.io.ebean\:ebean-api.developerConnection=scm\:git\:git@github.com\:ebean-orm/ebean.git
|
||||
project.dev.io.ebean\:ebean-api=12.12.3-SNAPSHOT
|
||||
project.rel.io.ebean\:ebean=12.12.2
|
||||
project.dev.io.ebean\:ebean-core-type=12.12.3-SNAPSHOT
|
||||
project.scm.io.ebean\:ebean-ddl-generator.developerConnection=scm\:git\:git@github.com\:ebean-orm/ebean.git
|
||||
exec.activateProfiles=release
|
||||
project.dev.io.ebean\:ebean-test=12.12.3-SNAPSHOT
|
||||
project.scm.io.ebean\:kotlin-querybean-generator.developerConnection=scm\:git\:git@github.com\:ebean-orm/ebean.git
|
||||
project.scm.io.ebean\:ebean-querybean.developerConnection=scm\:git\:git@github.com\:ebean-orm/ebean.git
|
||||
project.scm.io.ebean\:ebean-bom.developerConnection=scm\:git\:git@github.com\:ebean-orm/ebean.git
|
||||
project.scm.io.ebean\:ebean-core.developerConnection=scm\:git\:git@github.com\:ebean-orm/ebean.git
|
||||
project.rel.io.ebean\:ebean-core-type=12.12.2
|
||||
project.rel.io.ebean\:kotlin-querybean-generator=12.12.2
|
||||
project.dev.io.ebean\:querybean-generator=12.12.3-SNAPSHOT
|
||||
project.scm.io.ebean\:ebean-autotune.developerConnection=scm\:git\:git@github.com\:ebean-orm/ebean.git
|
||||
scm.commentPrefix=[maven-release-plugin]
|
||||
releaseStrategyId=default
|
||||
project.rel.io.ebean\:ebean-querybean=12.12.2
|
||||
project.scm.io.ebean\:ebean-externalmapping-api.developerConnection=scm\:git\:git@github.com\:ebean-orm/ebean.git
|
||||
project.scm.io.ebean\:querybean-generator.developerConnection=scm\:git\:git@github.com\:ebean-orm/ebean.git
|
||||
project.dev.io.ebean\:kotlin-querybean-generator=12.12.3-SNAPSHOT
|
||||
project.scm.io.ebean\:ebean-core-type.developerConnection=scm\:git\:git@github.com\:ebean-orm/ebean.git
|
||||
completedPhase=generate-release-poms
|
||||
project.rel.io.ebean\:ebean-redis=12.12.2
|
||||
project.scm.io.ebean\:ebean-test.developerConnection=scm\:git\:git@github.com\:ebean-orm/ebean.git
|
||||
project.scm.io.ebean\:ebean-postgis.developerConnection=scm\:git\:git@github.com\:ebean-orm/ebean.git
|
||||
project.dev.io.ebean\:ebean-autotune=12.12.3-SNAPSHOT
|
||||
project.rel.io.ebean\:ebean-api=12.12.2
|
||||
project.scm.io.ebean\:ebean-postgis.tag=HEAD
|
||||
project.scm.io.ebean\:querybean-generator.tag=HEAD
|
||||
project.rel.io.ebean\:querybean-generator=12.12.2
|
||||
scm.tag=ebean-parent-12.12.2
|
||||
project.rel.io.ebean\:ebean-externalmapping-xml=12.12.2
|
||||
project.scm.io.ebean\:ebean-ddl-generator.tag=HEAD
|
||||
project.rel.io.ebean\:ebean-externalmapping-api=12.12.2
|
||||
project.scm.io.ebean\:ebean-externalmapping-xml.tag=HEAD
|
||||
preparationGoals=clean verify
|
||||
exec.pomFileName=pom.xml
|
||||
project.dev.io.ebean\:ebean-externalmapping-api=12.12.3-SNAPSHOT
|
||||
project.dev.io.ebean\:ebean=12.12.3-SNAPSHOT
|
||||
project.scm.io.ebean\:ebean.developerConnection=scm\:git\:git@github.com\:ebean-orm/ebean.git
|
||||
project.dev.io.ebean\:ebean-parent=12.12.3-SNAPSHOT
|
||||
project.dev.io.ebean\:ebean-externalmapping-xml=12.12.3-SNAPSHOT
|
||||
project.rel.io.ebean\:ebean-core=12.12.2
|
||||
project.dev.io.ebean\:ebean-redis=12.12.3-SNAPSHOT
|
||||
project.dev.io.ebean\:ebean-postgis=12.12.3-SNAPSHOT
|
||||
project.scm.io.ebean\:ebean-redis.tag=HEAD
|
||||
project.scm.io.ebean\:ebean-parent.tag=HEAD
|
||||
pushChanges=true
|
||||
project.scm.io.ebean\:ebean-externalmapping-xml.developerConnection=scm\:git\:git@github.com\:ebean-orm/ebean.git
|
||||
project.rel.io.ebean\:ebean-test=12.12.2
|
||||
project.scm.io.ebean\:kotlin-querybean-generator.tag=HEAD
|
||||
project.scm.io.ebean\:ebean-bom.tag=HEAD
|
||||
project.scm.io.ebean\:ebean-autotune.tag=HEAD
|
||||
project.scm.io.ebean\:ebean.tag=HEAD
|
||||
project.scm.io.ebean\:ebean-core.tag=HEAD
|
||||
project.rel.io.ebean\:ebean-autotune=12.12.2
|
||||
scm.rollbackCommitComment=@{prefix} rollback the release of @{releaseLabel}
|
||||
remoteTagging=true
|
||||
project.dev.io.ebean\:ebean-bom=12.12.3-SNAPSHOT
|
||||
project.dev.io.ebean\:ebean-querybean=12.12.3-SNAPSHOT
|
||||
project.rel.io.ebean\:ebean-bom=12.12.2
|
||||
project.scm.io.ebean\:ebean-parent.developerConnection=scm\:git\:git@github.com\:ebean-orm/ebean.git
|
||||
scm.url=scm\:git\:git@github.com\:ebean-orm/ebean.git
|
||||
scm.developmentCommitComment=@{prefix} prepare for next development iteration
|
||||
project.scm.io.ebean\:ebean-externalmapping-api.tag=HEAD
|
||||
scm.tagNameFormat=@{project.artifactId}-@{project.version}
|
||||
project.scm.io.ebean\:ebean-test.tag=HEAD
|
||||
project.dev.io.ebean\:ebean-ddl-generator=12.12.3-SNAPSHOT
|
||||
exec.snapshotReleasePluginAllowed=false
|
||||
scm.releaseCommitComment=@{prefix} prepare release @{releaseLabel}
|
||||
project.rel.io.ebean\:ebean-postgis=12.12.2
|
||||
project.rel.io.ebean\:ebean-parent=12.12.2
|
||||
@@ -18,7 +18,7 @@
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
|
||||
<ebean-maven-plugin.version>12.12.0</ebean-maven-plugin.version>
|
||||
<ebean-maven-plugin.version>12.12.1</ebean-maven-plugin.version>
|
||||
<kotlin.version>1.5.31</kotlin.version>
|
||||
<jackson.version>2.12.1</jackson.version>
|
||||
</properties>
|
||||
@@ -95,7 +95,7 @@
|
||||
<id>test</id>
|
||||
<phase>process-test-classes</phase>
|
||||
<configuration>
|
||||
<transformArgs>debug=1</transformArgs>
|
||||
<transformArgs>debug=5</transformArgs>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>testEnhance</goal>
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package io.ebean.test.kotlin
|
||||
|
||||
import io.ebean.common.BeanList
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.example.order.Customer
|
||||
import org.example.order.Order
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class OneToManyEnhancementTest {
|
||||
|
||||
@Test
|
||||
fun `o2m is BeanCollection`() {
|
||||
val customer = Customer("foo")
|
||||
val order = Order(customer)
|
||||
|
||||
assertThat(order.items).isInstanceOf(BeanList::class.java)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user