diff --git a/.travis.yml b/.travis.yml index c55a51ebac..6846a084f5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,8 @@ cache: before_install: - sh -c "if [ '$RDBMS' = 'firebird' ]; then sh travis/before_install_firebird.sh; fi" install: - - sh -c "if [ '$LATEST_MAVEN' = 'true' ]; then sh travis/install_latest_maven.sh; fi" +# Skip the first maven execution for downloading dependencies by using this command + - /bin/true before_script: - sh -c "if [ '$RDBMS' = 'mysql' ]; then mysql -e 'create database IF NOT EXISTS test DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_bin;'; fi" - sh -c "if [ '$RDBMS' = 'postgresql' ]; then psql -c 'create database test;' -U postgres; fi" @@ -402,128 +403,94 @@ matrix: ################################################ # JDK 9+ ################################################ - - env: JPAPROVIDER=hibernate-5.2 RDBMS=h2 JDK=10 LATEST_MAVEN=true + - env: JPAPROVIDER=hibernate-5.2 RDBMS=h2 JDK=10 before_install: - wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh - . ./install-jdk.sh -F 10 -L GPL - - env: JPAPROVIDER=hibernate-5.2 RDBMS=h2 JDK=11 LATEST_MAVEN=true + - env: JPAPROVIDER=hibernate-5.2 RDBMS=h2 JDK=11 before_install: - wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh - . ./install-jdk.sh -F 11 -L BCL - - env: JPAPROVIDER=hibernate-5.2 RDBMS=h2 JDK=10 BUILD_JDK=10 LATEST_MAVEN=true + - env: JPAPROVIDER=hibernate-5.2 RDBMS=h2 JDK=10 BUILD_JDK=10 before_install: - wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh - . ./install-jdk.sh -F 10 -L GPL - - env: JPAPROVIDER=hibernate-5.2 RDBMS=h2 JDK=11 BUILD_JDK=11 LATEST_MAVEN=true + - env: JPAPROVIDER=hibernate-5.2 RDBMS=h2 JDK=11 BUILD_JDK=11 before_install: - wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh - . ./install-jdk.sh -F 11 -L BCL - - env: JPAPROVIDER=hibernate-5.2 RDBMS=h2 JDK=9 LATEST_MAVEN=true - addons: - apt: - packages: - - oracle-java9-installer - jdk: oraclejdk9 - - env: JPAPROVIDER=datanucleus-5 RDBMS=h2 JDK=9 LATEST_MAVEN=true - addons: - apt: - packages: - - oracle-java9-installer - jdk: oraclejdk9 - - env: JPAPROVIDER=eclipselink RDBMS=h2 JDK=9 LATEST_MAVEN=true - addons: - apt: - packages: - - oracle-java9-installer - jdk: oraclejdk9 -# - env: JPAPROVIDER=hibernate-5.3 RDBMS=h2 JDK=9 LATEST_MAVEN=true -# addons: -# apt: -# packages: -# - oracle-java9-installer -# jdk: oraclejdk9 -# - env: JPAPROVIDER=datanucleus-5.1 RDBMS=h2 JDK=9 LATEST_MAVEN=true -# addons: -# apt: -# packages: -# - oracle-java9-installer -# jdk: oraclejdk9 + - env: JPAPROVIDER=hibernate-5.2 RDBMS=h2 JDK=9 + before_install: + - wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh + - . ./install-jdk.sh -F 9 -L GPL + - env: JPAPROVIDER=datanucleus-5 RDBMS=h2 JDK=9 + before_install: + - wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh + - . ./install-jdk.sh -F 9 -L GPL + - env: JPAPROVIDER=eclipselink RDBMS=h2 JDK=9 + before_install: + - wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh + - . ./install-jdk.sh -F 9 -L GPL +# - env: JPAPROVIDER=hibernate-5.3 RDBMS=h2 JDK=9 +# before_install: +# - wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh +# - . ./install-jdk.sh -F 9 -L GPL +# - env: JPAPROVIDER=datanucleus-5.1 RDBMS=h2 JDK=9 +# before_install: +# - wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh +# - . ./install-jdk.sh -F 9 -L GPL ################################################ # Skip JDK 9 profile combinations for older JPA provider versions ################################################ -# - env: JPAPROVIDER=hibernate-5.1 RDBMS=h2 JDK=9 LATEST_MAVEN=true -# addons: -# apt: -# packages: -# - oracle-java9-installer -# jdk: oraclejdk9 -# - env: JPAPROVIDER=hibernate-5.0 RDBMS=h2 JDK=9 LATEST_MAVEN=true -# addons: -# apt: -# packages: -# - oracle-java9-installer -# jdk: oraclejdk9 -# - env: JPAPROVIDER=hibernate-4.3 RDBMS=h2 JDK=9 LATEST_MAVEN=true -# addons: -# apt: -# packages: -# - oracle-java9-installer -# jdk: oraclejdk9 -# - env: JPAPROVIDER=hibernate-4.2 RDBMS=h2 JDK=9 LATEST_MAVEN=true -# addons: -# apt: -# packages: -# - oracle-java9-installer -# jdk: oraclejdk9 -# - env: JPAPROVIDER=datanucleus-4 RDBMS=h2 JDK=9 LATEST_MAVEN=true -# addons: -# apt: -# packages: -# - oracle-java9-installer -# jdk: oraclejdk9 +# - env: JPAPROVIDER=hibernate-5.1 RDBMS=h2 JDK=9 +# before_install: +# - wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh +# - . ./install-jdk.sh -F 9 -L GPL +# - env: JPAPROVIDER=hibernate-5.0 RDBMS=h2 JDK=9 +# before_install: +# - wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh +# - . ./install-jdk.sh -F 9 -L GPL +# - env: JPAPROVIDER=hibernate-4.3 RDBMS=h2 JDK=9 +# before_install: +# - wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh +# - . ./install-jdk.sh -F 9 -L GPL +# - env: JPAPROVIDER=hibernate-4.2 RDBMS=h2 JDK=9 +# before_install: +# - wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh +# - . ./install-jdk.sh -F 9 -L GPL +# - env: JPAPROVIDER=datanucleus-4 RDBMS=h2 JDK=9 +# before_install: +# - wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh +# - . ./install-jdk.sh -F 9 -L GPL allow_failures: - - env: JPAPROVIDER=hibernate-5.2 RDBMS=h2 JDK=10 BUILD_JDK=10 LATEST_MAVEN=true - - env: JPAPROVIDER=hibernate-5.2 RDBMS=h2 JDK=11 BUILD_JDK=11 LATEST_MAVEN=true - - env: JPAPROVIDER=hibernate-5.2 RDBMS=h2 JDK=11 LATEST_MAVEN=true -# - env: JPAPROVIDER=hibernate-5.3 RDBMS=h2 JDK=9 LATEST_MAVEN=true -# addons: -# apt: -# packages: -# - oracle-java9-installer -# jdk: oraclejdk9 -# - env: JPAPROVIDER=datanucleus-5.1 RDBMS=h2 JDK=9 LATEST_MAVEN=true -# addons: -# apt: -# packages: -# - oracle-java9-installer -# jdk: oraclejdk9 -# - env: JPAPROVIDER=hibernate-5.1 RDBMS=h2 JDK=9 LATEST_MAVEN=true -# addons: -# apt: -# packages: -# - oracle-java9-installer -# jdk: oraclejdk9 -# - env: JPAPROVIDER=hibernate-5.0 RDBMS=h2 JDK=9 LATEST_MAVEN=true -# addons: -# apt: -# packages: -# - oracle-java9-installer -# jdk: oraclejdk9 -# - env: JPAPROVIDER=hibernate-4.3 RDBMS=h2 JDK=9 LATEST_MAVEN=true -# addons: -# apt: -# packages: -# - oracle-java9-installer -# jdk: oraclejdk9 -# - env: JPAPROVIDER=hibernate-4.2 RDBMS=h2 JDK=9 LATEST_MAVEN=true -# addons: -# apt: -# packages: -# - oracle-java9-installer -# jdk: oraclejdk9 -# - env: JPAPROVIDER=datanucleus-4 RDBMS=h2 JDK=9 LATEST_MAVEN=true -# addons: -# apt: -# packages: -# - oracle-java9-installer -# jdk: oraclejdk9 \ No newline at end of file + - env: JPAPROVIDER=hibernate-5.2 RDBMS=h2 JDK=10 BUILD_JDK=10 + - env: JPAPROVIDER=hibernate-5.2 RDBMS=h2 JDK=11 BUILD_JDK=11 + - env: JPAPROVIDER=hibernate-5.2 RDBMS=h2 JDK=11 +# - env: JPAPROVIDER=hibernate-5.3 RDBMS=h2 JDK=9 +# before_install: +# - wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh +# - . ./install-jdk.sh -F 9 -L GPL +# - env: JPAPROVIDER=datanucleus-5.1 RDBMS=h2 JDK=9 +# before_install: +# - wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh +# - . ./install-jdk.sh -F 9 -L GPL +# - env: JPAPROVIDER=hibernate-5.1 RDBMS=h2 JDK=9 +# before_install: +# - wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh +# - . ./install-jdk.sh -F 9 -L GPL +# - env: JPAPROVIDER=hibernate-5.0 RDBMS=h2 JDK=9 +# before_install: +# - wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh +# - . ./install-jdk.sh -F 9 -L GPL +# - env: JPAPROVIDER=hibernate-4.3 RDBMS=h2 JDK=9 +# before_install: +# - wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh +# - . ./install-jdk.sh -F 9 -L GPL +# - env: JPAPROVIDER=hibernate-4.2 RDBMS=h2 JDK=9 +# before_install: +# - wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh +# - . ./install-jdk.sh -F 9 -L GPL +# - env: JPAPROVIDER=datanucleus-4 RDBMS=h2 JDK=9 +# before_install: +# - wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh +# - . ./install-jdk.sh -F 9 -L GPL \ No newline at end of file diff --git a/README.md b/README.md index 64ffad8f60..3567b704e2 100644 --- a/README.md +++ b/README.md @@ -570,6 +570,15 @@ Setup local development Here some notes about setting up a local environment for testing. +## Setup general build environment + +Although Blaze-Persistence still supports running on Java 7, the build must be run with at least JDK 8. +When doing a release at least a JDK 9 is required as we need to build some Multi-Release or MR JARs. +Since we try to support the latest JDK versions as well, we require developers that want to build the project with JDK 11+ to define a system property. + +The system property `jdk8.home` should be set to the path to a Java 7 or 8 installation that contains either `jre/lib/rt.jar` or `jre/lib/classes.jar`. +This property is necessary when using JDK 11+ because `sun.misc.Unsafe.defineClass` was removed. + ## Building the website and documentation You have to install [GraphViz](http://www.graphviz.org/Download.php) and make it available in your PATH. diff --git a/build.sh b/build.sh index d2c9d67815..78c7369e05 100755 --- a/build.sh +++ b/build.sh @@ -1,14 +1,18 @@ #!/bin/bash set -e +set -x + +SOURCE="${BASH_SOURCE[0]}" +while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink + DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + SOURCE="$(readlink "$SOURCE")" + [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located +done +DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" if [ "$JDK" != "" ]; then - MVN_BIN=/tmp/apache-maven/bin/mvn - export MAVEN_OPTS="-Xmx1024m -XX:MaxMetaspaceSize=512m" # --add-modules=java.se.ee" -elif [ "$LATEST_MAVEN" = "true" ]; then - MVN_BIN=/tmp/apache-maven/bin/mvn export MAVEN_OPTS="-Xmx1024m -XX:MaxMetaspaceSize=512m" # --add-modules=java.se.ee" else - MVN_BIN=mvn export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=512m" fi @@ -16,19 +20,23 @@ if [ "$JDK" = "9" ]; then export JAVA_HOME="/usr/lib/jvm/java-9-oracle/" fi -${MVN_BIN} -version +mvn -version PROPERTIES="$PROPERTIES -Duser.country=US -Duser.language=en" if [ "$BUILD_JDK" != "" ]; then - PROPERTIES="$PROPERTIES -Dmaven.compiler.target=$BUILD_JDK -Dmaven.compiler.source=$BUILD_JDK" + PROPERTIES="$PROPERTIES -Djava.version=$BUILD_JDK" +fi + +if [ "$JDK" != "" ]; then + PROPERTIES="$PROPERTIES -Djdk8.home=/usr/lib/jvm/java-8-oracle" fi if [ "$TRAVIS_REPO_SLUG" == "Blazebit/blaze-persistence" ] && [ "$TRAVIS_BRANCH" == "master" ] && [ "$JPAPROVIDER" == "hibernate-5.2" ] && [ "$RDBMS" == "h2" ]; then - exec ${MVN_BIN} -P ${JPAPROVIDER},${RDBMS},${SPRING_DATA:-spring-data-1.11.x},${DELTASPIKE:-deltaspike-1.7} install + exec mvn -P ${JPAPROVIDER},${RDBMS},${SPRING_DATA:-spring-data-1.11.x},${DELTASPIKE:-deltaspike-1.7} clean install -V $PROPERTIES else if [ "$TRAVIS_REPO_SLUG" == "Blazebit/blaze-persistence" ] && [ "$TRAVIS_BRANCH" == "master" ] && @@ -42,5 +50,5 @@ else : # do nothing right now fi - eval exec ${MVN_BIN} -P ${JPAPROVIDER},${RDBMS},${SPRING_DATA:-spring-data-1.11.x},${DELTASPIKE:-deltaspike-1.7} install --projects "core/testsuite,entity-view/testsuite,jpa-criteria/testsuite,integration/deltaspike-data/testsuite,integration/spring-data/testsuite,examples/spring-data-rest,examples/showcase/runner/spring,examples/showcase/runner/cdi" -am $PROPERTIES + eval exec mvn -P ${JPAPROVIDER},${RDBMS},${SPRING_DATA:-spring-data-1.11.x},${DELTASPIKE:-deltaspike-1.7} clean install --projects "core/testsuite,entity-view/testsuite,jpa-criteria/testsuite,integration/deltaspike-data/testsuite,integration/spring-data/testsuite,examples/spring-data-rest,examples/showcase/runner/spring,examples/showcase/runner/cdi" -am -V $PROPERTIES fi diff --git a/core/api/pom.xml b/core/api/pom.xml index d3c8da3cdc..703f1b63fd 100644 --- a/core/api/pom.xml +++ b/core/api/pom.xml @@ -42,4 +42,102 @@ provided + + + + + org.moditect + moditect-maven-plugin + + + add-module-infos + post-package + + add-module-info + + + ${project.version}-module + + + module ${module.name} { + requires transitive java.sql; + requires transitive java.persistence; + exports com.blazebit.persistence; + exports com.blazebit.persistence.spi; + exports com.blazebit.persistence.internal; + uses com.blazebit.persistence.spi.CriteriaBuilderConfigurationProvider; + } + + + + + + + + + + + + java9 + + [1.9,) + + + src/main/java9 + + + + + maven-antrun-plugin + + + compile-java9 + compile + + + + + + + + run + + + + + + maven-jar-plugin + true + + + + true + + + + + + default-jar + package + + jar + + + + modular-jar + package + + jar + + + module + + + + + + + + diff --git a/core/api/src/main/java/com/blazebit/persistence/Criteria.java b/core/api/src/main/java/com/blazebit/persistence/Criteria.java index 7d25dbcb04..0d31dbaa1d 100644 --- a/core/api/src/main/java/com/blazebit/persistence/Criteria.java +++ b/core/api/src/main/java/com/blazebit/persistence/Criteria.java @@ -56,6 +56,6 @@ public static CriteriaBuilderConfigurationProvider getDefaultProvider() { * @return A new criteria builder configuration */ public static CriteriaBuilderConfiguration getDefault() { - return getDefaultProvider().createConfiguration(); + return getDefaultProvider().createConfiguration(DefaultPackageOpener.INSTANCE); } } diff --git a/core/api/src/main/java/com/blazebit/persistence/DefaultPackageOpener.java b/core/api/src/main/java/com/blazebit/persistence/DefaultPackageOpener.java new file mode 100644 index 0000000000..5b69f4e13f --- /dev/null +++ b/core/api/src/main/java/com/blazebit/persistence/DefaultPackageOpener.java @@ -0,0 +1,37 @@ +/* + * Copyright 2014 - 2018 Blazebit. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.blazebit.persistence; + +import com.blazebit.persistence.spi.PackageOpener; + +/** + * A no-op package opener for pre-Java 9. + * + * @author Christian Beikov + * @since 1.2.0 + */ +class DefaultPackageOpener implements PackageOpener { + + static final PackageOpener INSTANCE = new DefaultPackageOpener(); + + private DefaultPackageOpener() { + } + + @Override + public void openPackageIfNeeded(Class targetClass, String targetPackage, Class implementationClass) { + } +} diff --git a/core/api/src/main/java/com/blazebit/persistence/spi/CriteriaBuilderConfiguration.java b/core/api/src/main/java/com/blazebit/persistence/spi/CriteriaBuilderConfiguration.java index b02d4750ac..02531e380f 100644 --- a/core/api/src/main/java/com/blazebit/persistence/spi/CriteriaBuilderConfiguration.java +++ b/core/api/src/main/java/com/blazebit/persistence/spi/CriteriaBuilderConfiguration.java @@ -32,6 +32,15 @@ */ public interface CriteriaBuilderConfiguration { + /** + * Sets the package opener to use for obtaining access to user classes. + * + * @param packageOpener The package opener to use to obtain access to user classes + * @return this for method chaining + * @since 1.2.0 + */ + public CriteriaBuilderConfiguration withPackageOpener(PackageOpener packageOpener); + /** * Registers the given type under the given name. This makes the type usable for the VALUES clause. * diff --git a/core/api/src/main/java/com/blazebit/persistence/spi/CriteriaBuilderConfigurationProvider.java b/core/api/src/main/java/com/blazebit/persistence/spi/CriteriaBuilderConfigurationProvider.java index ceb9d01f6f..186ff91e02 100644 --- a/core/api/src/main/java/com/blazebit/persistence/spi/CriteriaBuilderConfigurationProvider.java +++ b/core/api/src/main/java/com/blazebit/persistence/spi/CriteriaBuilderConfigurationProvider.java @@ -32,4 +32,13 @@ public interface CriteriaBuilderConfigurationProvider { * @return A new criteria builder configuration */ public CriteriaBuilderConfiguration createConfiguration(); + + /** + * Creates and returns a new criteria builder configuration. + * + * @param packageOpener The package opener to use to obtain access to user classes + * @return A new criteria builder configuration + * @since 1.2.0 + */ + public CriteriaBuilderConfiguration createConfiguration(PackageOpener packageOpener); } diff --git a/core/api/src/main/java/com/blazebit/persistence/spi/PackageOpener.java b/core/api/src/main/java/com/blazebit/persistence/spi/PackageOpener.java new file mode 100644 index 0000000000..ca3bcbcf02 --- /dev/null +++ b/core/api/src/main/java/com/blazebit/persistence/spi/PackageOpener.java @@ -0,0 +1,44 @@ +/* + * Copyright 2014 - 2018 Blazebit. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.blazebit.persistence.spi; + +/** + * A package opener can be used to propagate module visibilities. + * + * @author Christian Beikov + * @since 1.2.0 + */ +public interface PackageOpener { + + /** + * A no-op package opener. + */ + public static final PackageOpener NOOP = new PackageOpener() { + @Override + public void openPackageIfNeeded(Class targetClass, String targetPackage, Class implementationClass) { + } + }; + + /** + * Opens the given package of the module of the target class to the module of the implementation class. + * + * @param targetClass The class by which to obtain the module that should be opened. + * @param targetPackage The package of the module that should be opened. + * @param implementationClass The class by which to obtain the module to which the given package should be opened. + */ + public void openPackageIfNeeded(Class targetClass, String targetPackage, Class implementationClass); +} diff --git a/core/api/src/main/java9/com/blazebit/persistence/DefaultPackageOpener.java b/core/api/src/main/java9/com/blazebit/persistence/DefaultPackageOpener.java new file mode 100644 index 0000000000..f80e6e609d --- /dev/null +++ b/core/api/src/main/java9/com/blazebit/persistence/DefaultPackageOpener.java @@ -0,0 +1,41 @@ +/* + * Copyright 2014 - 2018 Blazebit. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.blazebit.persistence; + +import com.blazebit.persistence.spi.PackageOpener; + +/** + * A package opener that works with Java 9 modules. + * + * @author Christian Beikov + * @since 1.2.0 + */ +class DefaultPackageOpener implements PackageOpener { + + static final PackageOpener INSTANCE = new DefaultPackageOpener(); + + private DefaultPackageOpener() { + } + + @Override + public void openPackageIfNeeded(Class targetClass, String targetPackage, Class implementationClass) { + Module targetModule = targetClass.getModule(); + if (!targetModule.isOpen(targetPackage, implementationClass.getModule())) { + targetModule.addOpens(targetPackage, implementationClass.getModule()); + } + } +} diff --git a/core/impl/pom.xml b/core/impl/pom.xml index cb87fba6a4..649633de5a 100644 --- a/core/impl/pom.xml +++ b/core/impl/pom.xml @@ -100,7 +100,103 @@ + + org.moditect + moditect-maven-plugin + + + add-module-infos + post-package + + add-module-info + + + ${project.version}-module + + + module ${module.name} { + requires java.sql; + requires java.persistence; + requires com.blazebit.common.utils; + requires com.blazebit.persistence.core; + requires com.blazebit.persistence.core.parser; + exports com.blazebit.persistence.impl; + uses com.blazebit.persistence.spi.EntityManagerFactoryIntegrator; + uses com.blazebit.persistence.spi.ExtendedQuerySupport; + provides com.blazebit.persistence.spi.CriteriaBuilderConfigurationProvider with com.blazebit.persistence.impl.CriteriaBuilderConfigurationProviderImpl; + } + + + + + + + + + java9 + + [1.9,) + + + src/main/java9 + + + + + maven-antrun-plugin + + + compile-java9 + compile + + + + + + + + run + + + + + + maven-jar-plugin + true + + + + true + + + + + + default-jar + package + + jar + + + + modular-jar + package + + jar + + + module + + + + + + + + + diff --git a/core/impl/src/main/java/com/blazebit/persistence/impl/CallerChecker.java b/core/impl/src/main/java/com/blazebit/persistence/impl/CallerChecker.java new file mode 100644 index 0000000000..253e0564c8 --- /dev/null +++ b/core/impl/src/main/java/com/blazebit/persistence/impl/CallerChecker.java @@ -0,0 +1,33 @@ +/* + * Copyright 2014 - 2018 Blazebit. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.blazebit.persistence.impl; + +/** + * A contract that checks if the caller of our caller is trusted. On Java 9 this will actually check modules. + * + * @author Christian Beikov + * @since 1.2.0 + */ +class CallerChecker { + + private CallerChecker() { + } + + public static boolean isCallerTrusted() { + return true; + } +} diff --git a/core/impl/src/main/java/com/blazebit/persistence/impl/CriteriaBuilderConfigurationImpl.java b/core/impl/src/main/java/com/blazebit/persistence/impl/CriteriaBuilderConfigurationImpl.java index 3c4310524e..a79a24e9f4 100644 --- a/core/impl/src/main/java/com/blazebit/persistence/impl/CriteriaBuilderConfigurationImpl.java +++ b/core/impl/src/main/java/com/blazebit/persistence/impl/CriteriaBuilderConfigurationImpl.java @@ -150,6 +150,7 @@ import com.blazebit.persistence.spi.ExtendedQuerySupport; import com.blazebit.persistence.spi.JpqlFunctionGroup; import com.blazebit.persistence.spi.JpqlMacro; +import com.blazebit.persistence.spi.PackageOpener; import com.blazebit.persistence.spi.SetOperationType; import javax.persistence.EntityManagerFactory; @@ -180,10 +181,12 @@ public class CriteriaBuilderConfigurationImpl implements CriteriaBuilderConfigur private final Map> treatTypes = new HashMap>(); private final Map macros = new HashMap(); private final List entityManagerIntegrators = new ArrayList(); + private PackageOpener packageOpener; private Properties properties = new Properties(); private ExtendedQuerySupport extendedQuerySupport; - public CriteriaBuilderConfigurationImpl() { + public CriteriaBuilderConfigurationImpl(PackageOpener packageOpener) { + this.packageOpener = packageOpener; loadDefaultProperties(); loadExtendedQuerySupport(); loadEntityManagerIntegrator(); @@ -525,6 +528,16 @@ private void loadEntityManagerIntegrator() { } } + @Override + public CriteriaBuilderConfiguration withPackageOpener(PackageOpener packageOpener) { + this.packageOpener = packageOpener; + return this; + } + + PackageOpener getPackageOpener() { + return packageOpener; + } + @Override public CriteriaBuilderConfiguration registerFunction(JpqlFunctionGroup jpqlFunctionGroup) { String functionName = jpqlFunctionGroup.getName().toLowerCase(); diff --git a/core/impl/src/main/java/com/blazebit/persistence/impl/CriteriaBuilderConfigurationProviderImpl.java b/core/impl/src/main/java/com/blazebit/persistence/impl/CriteriaBuilderConfigurationProviderImpl.java index c0409853a3..5c3d6ce69f 100644 --- a/core/impl/src/main/java/com/blazebit/persistence/impl/CriteriaBuilderConfigurationProviderImpl.java +++ b/core/impl/src/main/java/com/blazebit/persistence/impl/CriteriaBuilderConfigurationProviderImpl.java @@ -20,6 +20,7 @@ import com.blazebit.persistence.spi.CriteriaBuilderConfiguration; import com.blazebit.persistence.spi.CriteriaBuilderConfigurationProvider; +import com.blazebit.persistence.spi.PackageOpener; /** * @@ -33,12 +34,17 @@ public class CriteriaBuilderConfigurationProviderImpl implements CriteriaBuilder @Override public CriteriaBuilderConfiguration createConfiguration() { + return createConfiguration(PackageOpener.NOOP); + } + + @Override + public CriteriaBuilderConfiguration createConfiguration(PackageOpener packageOpener) { if (!versionLogged) { LOG.info("Blaze-Persistence version: " + Version.printVersion()); versionLogged = true; } - return new CriteriaBuilderConfigurationImpl(); + return new CriteriaBuilderConfigurationImpl(packageOpener); } } diff --git a/core/impl/src/main/java/com/blazebit/persistence/impl/CriteriaBuilderFactoryImpl.java b/core/impl/src/main/java/com/blazebit/persistence/impl/CriteriaBuilderFactoryImpl.java index 34a9bce968..224f075b8e 100644 --- a/core/impl/src/main/java/com/blazebit/persistence/impl/CriteriaBuilderFactoryImpl.java +++ b/core/impl/src/main/java/com/blazebit/persistence/impl/CriteriaBuilderFactoryImpl.java @@ -37,6 +37,7 @@ import com.blazebit.persistence.spi.JpaProviderFactory; import com.blazebit.persistence.spi.JpqlFunction; import com.blazebit.persistence.spi.JpqlFunctionGroup; +import com.blazebit.persistence.spi.PackageOpener; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; @@ -55,6 +56,7 @@ */ public class CriteriaBuilderFactoryImpl implements CriteriaBuilderFactory { + private final PackageOpener packageOpener; private final EntityManagerFactory entityManagerFactory; private final EntityMetamodelImpl metamodel; private final AssociationParameterTransformerFactory transientEntityParameterTransformerFactory; @@ -93,6 +95,7 @@ public CriteriaBuilderFactoryImpl(CriteriaBuilderConfigurationImpl config, Entit dialect = dbmsDialects.get(null); } + this.packageOpener = config.getPackageOpener(); this.configuredDbms = dbms; this.configuredDbmsDialect = dialect; this.configuredRegisteredFunctions = registeredFunctions; @@ -329,6 +332,10 @@ public T getService(Class serviceClass) { return (T) metamodel; } else if (EntityManagerFactory.class.equals(serviceClass)) { return (T) entityManagerFactory; + } else if (PackageOpener.class.equals(serviceClass)) { + if (CallerChecker.isCallerTrusted()) { + return (T) packageOpener; + } } return null; diff --git a/core/impl/src/main/java9/com/blazebit/persistence/impl/CallerChecker.java b/core/impl/src/main/java9/com/blazebit/persistence/impl/CallerChecker.java new file mode 100644 index 0000000000..52ce6c4333 --- /dev/null +++ b/core/impl/src/main/java9/com/blazebit/persistence/impl/CallerChecker.java @@ -0,0 +1,37 @@ +/* + * Copyright 2014 - 2018 Blazebit. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.blazebit.persistence.impl; + +import java.util.Set; + +/** + * A contract that checks if the caller of our caller is trusted. On Java 9 this will actually check modules. + * + * @author Christian Beikov + * @since 1.2.0 + */ +class CallerChecker { + + private CallerChecker() { + } + + public static boolean isCallerTrusted() { + return StackWalker.getInstance(Set.of(), 2).walk(stackFrames -> { + return stackFrames.limit(2).allMatch(s -> s.getClassName().startsWith("com.blazebit.persistence.")); + }); + } +} diff --git a/core/impl/src/main/resources/META-INF/services/com.blazebit.persistence.spi.CriteriaBuilderConfigurationProvider b/core/impl/src/main/resources/META-INF/services/com.blazebit.persistence.spi.CriteriaBuilderConfigurationProvider index c0068cec27..85dfde3292 100644 --- a/core/impl/src/main/resources/META-INF/services/com.blazebit.persistence.spi.CriteriaBuilderConfigurationProvider +++ b/core/impl/src/main/resources/META-INF/services/com.blazebit.persistence.spi.CriteriaBuilderConfigurationProvider @@ -14,86 +14,4 @@ # limitations under the License. # -# -# Copyright 2014 - 2018 Blazebit. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# -# Copyright 2014 - 2018 Blazebit. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# -# Copyright 2014 - 2018 Blazebit. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# -# Copyright 2014 - 2018 Blazebit. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# -# /* -# * Copyright 2014 - 2018 Blazebit. -# * -# * Licensed under the Apache License, Version 2.0 (the "License"); -# * you may not use this file except in compliance with the License. -# * You may obtain a copy of the License at -# * -# * http://www.apache.org/licenses/LICENSE-2.0 -# * -# * Unless required by applicable law or agreed to in writing, software -# * distributed under the License is distributed on an "AS IS" BASIS, -# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# * See the License for the specific language governing permissions and -# * limitations under the License. -# */ -# - com.blazebit.persistence.impl.CriteriaBuilderConfigurationProviderImpl diff --git a/core/parser/pom.xml b/core/parser/pom.xml index 4b494c1dd5..8f72e5c86a 100644 --- a/core/parser/pom.xml +++ b/core/parser/pom.xml @@ -113,6 +113,36 @@ + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + ${project.version}-module + + + module ${module.name} { + requires java.sql; + requires java.persistence; + requires org.antlr.antlr4.runtime; + requires com.blazebit.common.utils; + exports com.blazebit.persistence.parser; + exports com.blazebit.persistence.parser.expression; + exports com.blazebit.persistence.parser.predicate; + exports com.blazebit.persistence.parser.util; + } + + + + + + diff --git a/core/testsuite/pom.xml b/core/testsuite/pom.xml index fee691d2aa..16b2195d4f 100644 --- a/core/testsuite/pom.xml +++ b/core/testsuite/pom.xml @@ -97,6 +97,43 @@ + + + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + ${project.version}-module + + + open module ${module.name} { + requires java.sql; + requires java.persistence; + requires com.blazebit.common.utils; + requires com.blazebit.persistence.core; + requires com.blazebit.persistence.core.parser; + requires com.blazebit.persistence.core.impl; + exports com.blazebit.persistence.testsuite; + exports com.blazebit.persistence.testsuite.entity; + exports com.blazebit.persistence.testsuite.treat.entity; + exports com.blazebit.persistence.testsuite.tx; + } + + + + + + + + + diff --git a/core/testsuite/src/main/java/com/blazebit/persistence/testsuite/entity/Version.java b/core/testsuite/src/main/java/com/blazebit/persistence/testsuite/entity/Version.java index 7c2bf62bdd..67cbf1a969 100644 --- a/core/testsuite/src/main/java/com/blazebit/persistence/testsuite/entity/Version.java +++ b/core/testsuite/src/main/java/com/blazebit/persistence/testsuite/entity/Version.java @@ -47,6 +47,13 @@ public class Version implements Serializable { private int idx; private String url; + public Version() { + } + + public Version(int idx) { + this.idx = idx; + } + @Id @GeneratedValue public Long getId() { diff --git a/entity-view/api/pom.xml b/entity-view/api/pom.xml index 4604fc98ee..32559e9d2d 100644 --- a/entity-view/api/pom.xml +++ b/entity-view/api/pom.xml @@ -47,4 +47,39 @@ provided + + + + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + ${project.version}-module + + + module ${module.name} { + requires transitive com.blazebit.persistence.core; + exports com.blazebit.persistence.view; + exports com.blazebit.persistence.view.change; + exports com.blazebit.persistence.view.filter; + exports com.blazebit.persistence.view.metamodel; + exports com.blazebit.persistence.view.spi; + exports com.blazebit.persistence.view.spi.type; + uses com.blazebit.persistence.view.spi.EntityViewConfigurationProvider; + } + + + + + + + + diff --git a/entity-view/impl/pom.xml b/entity-view/impl/pom.xml index 5c0ffc582e..91d938d2a7 100644 --- a/entity-view/impl/pom.xml +++ b/entity-view/impl/pom.xml @@ -120,6 +120,174 @@ + + org.moditect + moditect-maven-plugin + + + add-module-infos + post-package + + add-module-info + + + ${project.version}-module + + + module ${module.name} { + requires java.sql; + requires java.persistence; + requires com.blazebit.common.utils; + requires com.blazebit.persistence.core; + requires com.blazebit.persistence.core.parser; + requires com.blazebit.persistence.view; + exports com.blazebit.persistence.view.impl; + provides com.blazebit.persistence.view.spi.EntityViewConfigurationProvider with com.blazebit.persistence.view.impl.EntityViewConfigurationProviderImpl; + } + + + + + + + + + + pre-10-unsafe-code + + [1.7,11) + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + add-source + generate-sources + + add-source + + + + src/main/java8 + + + + + + + + + + post-10-unsafe-code + + [11,) + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + add-source + generate-sources + + add-source + + + + src/main/java8 + + + + + + + maven-compiler-plugin + + + default-compile + true + + + + ${jdk8.classes.jar} + 1.8 + 1.8 + + + + + + + + + + post-8-unsafe-code + + [1.9,) + + + src/main/java9 + + + + + maven-antrun-plugin + + + compile-java9 + compile + + + + + + + + run + + + + + + maven-jar-plugin + true + + + + true + + + + + + default-jar + package + + jar + + + + modular-jar + package + + jar + + + module + + + + + + + + diff --git a/entity-view/impl/src/main/java/com/blazebit/persistence/view/impl/EntityViewManagerImpl.java b/entity-view/impl/src/main/java/com/blazebit/persistence/view/impl/EntityViewManagerImpl.java index 51e158298e..1d4e04ba15 100644 --- a/entity-view/impl/src/main/java/com/blazebit/persistence/view/impl/EntityViewManagerImpl.java +++ b/entity-view/impl/src/main/java/com/blazebit/persistence/view/impl/EntityViewManagerImpl.java @@ -28,6 +28,7 @@ import com.blazebit.persistence.parser.util.JpaMetamodelUtils; import com.blazebit.persistence.spi.DbmsDialect; import com.blazebit.persistence.spi.JpaProvider; +import com.blazebit.persistence.spi.PackageOpener; import com.blazebit.persistence.view.AttributeFilterProvider; import com.blazebit.persistence.view.ConvertOption; import com.blazebit.persistence.view.EntityViewManager; @@ -107,6 +108,7 @@ public class EntityViewManagerImpl implements EntityViewManager { private final JpaProvider jpaProvider; private final DbmsDialect dbmsDialect; private final ExpressionFactory expressionFactory; + private final PackageOpener packageOpener; private final AttributeAccessor entityIdAccessor; private final ViewMetamodelImpl metamodel; private final ProxyFactory proxyFactory; @@ -125,9 +127,10 @@ public EntityViewManagerImpl(EntityViewConfigurationImpl config, CriteriaBuilder this.dbmsDialect = cbf.getService(DbmsDialect.class); EntityMetamodel entityMetamodel = cbf.getService(EntityMetamodel.class); this.expressionFactory = cbf.getService(ExpressionFactory.class); + this.packageOpener = cbf.getService(PackageOpener.class); this.entityIdAccessor = new EntityIdAttributeAccessor(cbf.getService(EntityManagerFactory.class).getPersistenceUnitUtil()); this.unsafeDisabled = !Boolean.valueOf(String.valueOf(config.getProperty(ConfigurationProperties.PROXY_UNSAFE_ALLOWED))); - this.proxyFactory = new ProxyFactory(unsafeDisabled); + this.proxyFactory = new ProxyFactory(unsafeDisabled, packageOpener); boolean validateExpressions = !Boolean.valueOf(String.valueOf(config.getProperty(ConfigurationProperties.EXPRESSION_VALIDATION_DISABLED))); diff --git a/entity-view/impl/src/main/java/com/blazebit/persistence/view/impl/proxy/ProxyFactory.java b/entity-view/impl/src/main/java/com/blazebit/persistence/view/impl/proxy/ProxyFactory.java index aa0fbd47cd..ba4cf0233f 100644 --- a/entity-view/impl/src/main/java/com/blazebit/persistence/view/impl/proxy/ProxyFactory.java +++ b/entity-view/impl/src/main/java/com/blazebit/persistence/view/impl/proxy/ProxyFactory.java @@ -18,6 +18,7 @@ import com.blazebit.lang.StringUtils; import com.blazebit.persistence.parser.util.JpaMetamodelUtils; +import com.blazebit.persistence.spi.PackageOpener; import com.blazebit.persistence.view.CorrelationProvider; import com.blazebit.persistence.view.EntityViewManager; import com.blazebit.persistence.view.FlushMode; @@ -111,6 +112,7 @@ public class ProxyFactory { private final Object proxyLock = new Object(); private final ClassPool pool; private final boolean unsafeDisabled; + private final PackageOpener packageOpener; /** * @author Christian Beikov @@ -143,9 +145,10 @@ public int hashCode() { } } - public ProxyFactory(boolean unsafeDisabled) { + public ProxyFactory(boolean unsafeDisabled, PackageOpener packageOpener) { this.pool = new ClassPool(ClassPool.getDefault()); this.unsafeDisabled = unsafeDisabled; + this.packageOpener = packageOpener; } public Class getProxy(EntityViewManager entityViewManager, ManagedViewTypeImplementor viewType, ManagedViewTypeImplementor inheritanceBase) { @@ -204,7 +207,7 @@ public Class getCorrelationProviderProxy(Class newConstructor.getMethodInfo().setCodeAttribute(bytecode.toCodeAttribute()); cc.addConstructor(newConstructor); - return cc.toClass(correlated.getClassLoader(), null); + return (Class) cc.toClass(correlated.getClassLoader(), null); } catch (Exception ex) { throw new RuntimeException("Probably we did something wrong, please contact us if you see this message.", ex); } finally { @@ -471,11 +474,14 @@ private Class createProxyClass(EntityViewManager entityViewMana private Class defineOrGetClass(EntityViewManager entityViewManager, boolean unsafe, Class clazz, String proxyClassName, CtClass cc) throws IOException, IllegalAccessException, NoSuchFieldException, CannotCompileException { try { + // Ask the package opener to allow deep access, otherwise defining the class will fail + packageOpener.openPackageIfNeeded(clazz, clazz.getPackage().getName(), ProxyFactory.class); + Class c; if (unsafe) { c = (Class) UnsafeHelper.define(cc.getName(), cc.toBytecode(), clazz); } else { - c = cc.toClass(clazz.getClassLoader(), null); + c = (Class) cc.toClass(clazz.getClassLoader(), null); } c.getField("$$_evm").set(null, entityViewManager); diff --git a/entity-view/impl/src/main/java/com/blazebit/persistence/view/impl/update/flush/CollectionAttributeFlusher.java b/entity-view/impl/src/main/java/com/blazebit/persistence/view/impl/update/flush/CollectionAttributeFlusher.java index 8f756d56c6..d4645ed8dd 100644 --- a/entity-view/impl/src/main/java/com/blazebit/persistence/view/impl/update/flush/CollectionAttributeFlusher.java +++ b/entity-view/impl/src/main/java/com/blazebit/persistence/view/impl/update/flush/CollectionAttributeFlusher.java @@ -185,6 +185,43 @@ protected boolean executeActions(UpdateContext context, Collection jpaCo return !actions.isEmpty(); } + @Override + @SuppressWarnings("unchecked") + public FetchGraphNode mergeWith(List> fetchGraphNodes) { + boolean fetchChanged = false; + List nestedFlushers = new ArrayList<>(fetchGraphNodes.size()); + for (int i = 0; i < fetchGraphNodes.size(); i++) { + CollectionAttributeFlusher node = fetchGraphNodes.get(i); + fetchChanged |= this.fetch != node.fetch; + if (node.nestedGraphNode != null) { + if (node.nestedGraphNode instanceof CollectionElementFetchGraphNode) { + nestedFlushers.add(((CollectionElementFetchGraphNode) node.nestedGraphNode).nestedGraphNode); + } else { + nestedFlushers.add(node.nestedGraphNode); + } + } + } + + final boolean newFetch = fetchChanged || this.fetch; + + if (nestedFlushers.isEmpty()) { + if (fetchChanged && this.fetch != newFetch) { + return new AttributeFetchGraphNode(attributeName, mapping, newFetch, fetchGraphNodes.get(0)); + } else { + return this; + } + } + FetchGraphNode firstFlusher = nestedFlushers.get(0); + FetchGraphNode fetchGraphNode = firstFlusher.mergeWith((List) nestedFlushers); + + // All fetch graph nodes have the same structure, so no need for new objects + if (!fetchChanged && fetchGraphNode == firstFlusher) { + return this; + } + + return new AttributeFetchGraphNode(attributeName, mapping, newFetch, fetchGraphNode); + } + @Override public void flushQuery(UpdateContext context, String parameterPrefix, Query query, Object view, V value) { if (!supportsQueryFlush()) { diff --git a/entity-view/impl/src/main/java/com/blazebit/persistence/view/impl/proxy/UnsafeHelper.java b/entity-view/impl/src/main/java8/com/blazebit/persistence/view/impl/proxy/UnsafeHelper.java similarity index 100% rename from entity-view/impl/src/main/java/com/blazebit/persistence/view/impl/proxy/UnsafeHelper.java rename to entity-view/impl/src/main/java8/com/blazebit/persistence/view/impl/proxy/UnsafeHelper.java diff --git a/entity-view/impl/src/main/java9/com/blazebit/persistence/view/impl/proxy/UnsafeHelper.java b/entity-view/impl/src/main/java9/com/blazebit/persistence/view/impl/proxy/UnsafeHelper.java new file mode 100644 index 0000000000..289754108c --- /dev/null +++ b/entity-view/impl/src/main/java9/com/blazebit/persistence/view/impl/proxy/UnsafeHelper.java @@ -0,0 +1,35 @@ +/* + * Copyright 2014 - 2018 Blazebit. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.blazebit.persistence.view.impl.proxy; + +import java.lang.invoke.MethodHandles; + +/** + * + * @author Christian Beikov + * @since 1.2.0 + */ +public class UnsafeHelper { + + public static Class define(String name, byte[] bytes, final Class declaringClass) { + try { + return MethodHandles.privateLookupIn(declaringClass, MethodHandles.lookup()).defineClass(bytes); + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} diff --git a/entity-view/testsuite/pom.xml b/entity-view/testsuite/pom.xml index 55a073e46d..69265c8a07 100644 --- a/entity-view/testsuite/pom.xml +++ b/entity-view/testsuite/pom.xml @@ -115,6 +115,39 @@ + + + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + ${project.version}-module + + + open module ${module.name} { + requires java.sql; + requires java.persistence; + requires com.blazebit.common.utils; + requires com.blazebit.persistence.core; + requires com.blazebit.persistence.core.parser; + requires com.blazebit.persistence.view; + requires com.blazebit.persistence.view.impl; + } + + + + + + + + diff --git a/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/entity/LegacyOrderPositionDefault.java b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/entity/LegacyOrderPositionDefault.java index 151066b218..63faa99c9f 100644 --- a/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/entity/LegacyOrderPositionDefault.java +++ b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/entity/LegacyOrderPositionDefault.java @@ -31,6 +31,7 @@ public class LegacyOrderPositionDefault implements Serializable { private LegacyOrderPositionDefaultId id; private LegacyOrderPosition orderPosition; + private String value; public LegacyOrderPositionDefault() { } @@ -73,6 +74,14 @@ public void setOrderPosition(LegacyOrderPosition orderPosition) { this.orderPosition = orderPosition; } + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + @Override public boolean equals(Object o) { if (this == o) return true; diff --git a/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/proxy/ProxyFactoryTest.java b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/proxy/ProxyFactoryTest.java index 9e8e572585..9a993362f8 100644 --- a/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/proxy/ProxyFactoryTest.java +++ b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/proxy/ProxyFactoryTest.java @@ -16,6 +16,7 @@ package com.blazebit.persistence.view.testsuite.proxy; +import com.blazebit.persistence.spi.PackageOpener; import com.blazebit.persistence.testsuite.entity.Person; import com.blazebit.persistence.view.impl.metamodel.ManagedViewTypeImplementor; import com.blazebit.persistence.view.impl.proxy.ConstructorReflectionInstantiator; @@ -48,7 +49,7 @@ */ public class ProxyFactoryTest extends AbstractEntityViewTest { - private final ProxyFactory proxyFactory = new ProxyFactory(false); + private final ProxyFactory proxyFactory = new ProxyFactory(false, PackageOpener.NOOP); private ViewMetamodel getViewMetamodel() { return build( diff --git a/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/complex/EntityViewUpdateSubviewInverseEmbeddedTest.java b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/complex/EntityViewUpdateSubviewInverseEmbeddedTest.java new file mode 100644 index 0000000000..c63c8d1ecf --- /dev/null +++ b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/complex/EntityViewUpdateSubviewInverseEmbeddedTest.java @@ -0,0 +1,208 @@ +/* + * Copyright 2014 - 2018 Blazebit. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.complex; + +import com.blazebit.persistence.testsuite.base.jpa.assertion.AssertStatementBuilder; +import com.blazebit.persistence.testsuite.base.jpa.category.NoDatanucleus; +import com.blazebit.persistence.testsuite.base.jpa.category.NoEclipselink; +import com.blazebit.persistence.testsuite.entity.Document; +import com.blazebit.persistence.testsuite.entity.Person; +import com.blazebit.persistence.view.EntityViewSetting; +import com.blazebit.persistence.view.FlushMode; +import com.blazebit.persistence.view.FlushStrategy; +import com.blazebit.persistence.view.change.PluralChangeModel; +import com.blazebit.persistence.view.spi.EntityViewConfiguration; +import com.blazebit.persistence.view.testsuite.entity.LegacyOrder; +import com.blazebit.persistence.view.testsuite.entity.LegacyOrderPosition; +import com.blazebit.persistence.view.testsuite.entity.LegacyOrderPositionDefault; +import com.blazebit.persistence.view.testsuite.entity.LegacyOrderPositionDefaultId; +import com.blazebit.persistence.view.testsuite.entity.LegacyOrderPositionId; +import com.blazebit.persistence.view.testsuite.update.AbstractEntityViewUpdateTest; +import com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.complex.model.LegacyOrderIdView; +import com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.complex.model.LegacyOrderPositionDefaultIdView; +import com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.complex.model.LegacyOrderPositionIdView; +import com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.complex.model.UpdatableLegacyOrderPositionDefaultView; +import com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.complex.model.UpdatableLegacyOrderPositionView; +import com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.complex.model.UpdatableLegacyOrderView; +import org.junit.Assert; +import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +import java.util.Iterator; + +/** + * + * @author Christian Beikov + * @since 1.2.0 + */ +@RunWith(Parameterized.class) +// NOTE: No Datanucleus support yet +@Category({ NoDatanucleus.class, NoEclipselink.class}) +public class EntityViewUpdateSubviewInverseEmbeddedTest extends AbstractEntityViewUpdateTest { + + @Override + protected Class[] getEntityClasses() { + return new Class[]{ + LegacyOrder.class, + LegacyOrderPosition.class, + LegacyOrderPositionId.class, + LegacyOrderPositionDefault.class, + LegacyOrderPositionDefaultId.class + }; + } + + public EntityViewUpdateSubviewInverseEmbeddedTest(FlushMode mode, FlushStrategy strategy, boolean version) { + super(mode, strategy, version, UpdatableLegacyOrderView.class); + } + + @Parameterized.Parameters(name = "{0} - {1} - VERSIONED={2}") + public static Object[][] combinations() { + return MODE_STRATEGY_VERSION_COMBINATIONS; + } + + @Override + protected void registerViewTypes(EntityViewConfiguration cfg) { + cfg.addEntityView(LegacyOrderIdView.class); + cfg.addEntityView(LegacyOrderPositionIdView.class); + cfg.addEntityView(LegacyOrderPositionIdView.Id.class); + cfg.addEntityView(LegacyOrderPositionDefaultIdView.class); + cfg.addEntityView(LegacyOrderPositionDefaultIdView.Id.class); + cfg.addEntityView(UpdatableLegacyOrderView.class); + cfg.addEntityView(UpdatableLegacyOrderPositionView.class); + cfg.addEntityView(UpdatableLegacyOrderPositionDefaultView.class); + } + + @Test + public void testAddNewElementToCollection() { + // Given + UpdatableLegacyOrderView newOrder = evm.create(UpdatableLegacyOrderView.class); + update(newOrder); + + // When + UpdatableLegacyOrderPositionView position = evm.create(UpdatableLegacyOrderPositionView.class); + position.getId().setPositionId(0); + newOrder.getPositions().add(position); + update(newOrder); + + // Then + restartTransaction(); + LegacyOrder legacyOrder = em.find(LegacyOrder.class, newOrder.getId()); + Assert.assertEquals(1, legacyOrder.getPositions().size()); + Assert.assertEquals(new LegacyOrderPositionId(newOrder.getId(), 0), legacyOrder.getPositions().iterator().next().getId()); + } + + @Test + public void testAddNewElementToCollectionAndUpdate() { + // Given + UpdatableLegacyOrderView newOrder = evm.create(UpdatableLegacyOrderView.class); + UpdatableLegacyOrderPositionView position = evm.create(UpdatableLegacyOrderPositionView.class); + position.getId().setPositionId(0); + newOrder.getPositions().add(position); + UpdatableLegacyOrderPositionDefaultView positionDefault = evm.create(UpdatableLegacyOrderPositionDefaultView.class); + positionDefault.getId().setSupplierId(1); + position.getDefaults().add(positionDefault); + update(newOrder); + + // When + newOrder.getPositions().iterator().next().getDefaults().iterator().next().setValue("NEW"); + position = evm.create(UpdatableLegacyOrderPositionView.class); + position.getId().setPositionId(1); + newOrder.getPositions().add(position); + positionDefault = evm.create(UpdatableLegacyOrderPositionDefaultView.class); + positionDefault.getId().setSupplierId(2); + position.getDefaults().add(positionDefault); + update(newOrder); + + // Then + restartTransaction(); + LegacyOrder legacyOrder = em.find(LegacyOrder.class, newOrder.getId()); + Assert.assertEquals(2, legacyOrder.getPositions().size()); + Iterator iterator = legacyOrder.getPositions().iterator(); + LegacyOrderPosition actualPosition = iterator.next(); + if (actualPosition.getId().getPositionId().equals(0)) { + actualPosition = iterator.next(); + } + Assert.assertEquals(new LegacyOrderPositionId(newOrder.getId(), 1), actualPosition.getId()); + } + + @Test + public void testRemoveReadOnlyElementFromCollection() { + // Given + UpdatableLegacyOrderView newOrder = evm.create(UpdatableLegacyOrderView.class); + UpdatableLegacyOrderPositionView position = evm.create(UpdatableLegacyOrderPositionView.class); + position.getId().setPositionId(0); + newOrder.getPositions().add(position); + update(newOrder); + + // When + restartTransaction(); + newOrder = evm.applySetting(EntityViewSetting.create(UpdatableLegacyOrderView.class), cbf.create(em, LegacyOrder.class)).getSingleResult(); + newOrder.getPositions().remove(newOrder.getPositions().iterator().next()); + PluralChangeModel positionsChangeModel = (PluralChangeModel) evm.getChangeModel(newOrder).get("positions"); + Assert.assertEquals(1, positionsChangeModel.getRemovedElements().size()); + update(newOrder); + + // Then + restartTransaction(); + LegacyOrder legacyOrder = em.find(LegacyOrder.class, newOrder.getId()); + Assert.assertEquals(0, legacyOrder.getPositions().size()); + } + + @Override + protected void restartTransactionAndReload() { + restartTransaction(); + } + + @Override + protected AssertStatementBuilder fullFetch(AssertStatementBuilder builder) { + return builder.assertSelect() + .fetching(Document.class) + .fetching(Person.class) + .fetching(Person.class) + .fetching(Document.class) + .fetching(Document.class, "people") + .fetching(Person.class) + .fetching(Person.class) + .fetching(Person.class) + .and(); + } + + @Override + protected AssertStatementBuilder fullUpdate(AssertStatementBuilder builder) { + fullFetch(builder) + .update(Person.class) + .update(Person.class) + .update(Person.class) + .update(Person.class) + .update(Document.class) + .update(Person.class) + .update(Person.class) + .update(Person.class); + if (version) { + builder.update(Document.class); + } + + return builder; + } + + @Override + protected AssertStatementBuilder versionUpdate(AssertStatementBuilder builder) { + return builder.update(Document.class); + } +} diff --git a/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/complex/model/IdHolderView.java b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/complex/model/IdHolderView.java new file mode 100644 index 0000000000..63b8bdec87 --- /dev/null +++ b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/complex/model/IdHolderView.java @@ -0,0 +1,34 @@ +/* + * Copyright 2014 - 2018 Blazebit. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.complex.model; + +import com.blazebit.persistence.view.IdMapping; + +import java.io.Serializable; + +/** + * + * @author Christian Beikov + * @since 1.0.0 + */ +public interface IdHolderView extends Serializable { + + @IdMapping + public T getId(); + + public void setId(T id); +} diff --git a/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/complex/model/LegacyOrderIdView.java b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/complex/model/LegacyOrderIdView.java new file mode 100644 index 0000000000..c90e967eba --- /dev/null +++ b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/complex/model/LegacyOrderIdView.java @@ -0,0 +1,29 @@ +/* + * Copyright 2014 - 2018 Blazebit. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.complex.model; + +import com.blazebit.persistence.view.EntityView; +import com.blazebit.persistence.view.testsuite.entity.LegacyOrder; + +/** + * + * @author Christian Beikov + * @since 1.2.0 + */ +@EntityView(LegacyOrder.class) +public interface LegacyOrderIdView extends IdHolderView { +} diff --git a/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/complex/model/LegacyOrderPositionDefaultIdView.java b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/complex/model/LegacyOrderPositionDefaultIdView.java new file mode 100644 index 0000000000..4d4b85ee5b --- /dev/null +++ b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/complex/model/LegacyOrderPositionDefaultIdView.java @@ -0,0 +1,45 @@ +/* + * Copyright 2014 - 2018 Blazebit. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.complex.model; + +import com.blazebit.persistence.view.EntityView; +import com.blazebit.persistence.view.UpdatableEntityView; +import com.blazebit.persistence.view.testsuite.entity.LegacyOrderPositionDefault; +import com.blazebit.persistence.view.testsuite.entity.LegacyOrderPositionDefaultId; + +/** + * + * @author Christian Beikov + * @since 1.2.0 + */ +@EntityView(LegacyOrderPositionDefault.class) +public interface LegacyOrderPositionDefaultIdView extends IdHolderView { + + @UpdatableEntityView + @EntityView(LegacyOrderPositionDefaultId.class) + interface Id { + + Long getOrderId(); + void setOrderId(Long orderId); + + Integer getPosition(); + void setPosition(Integer position); + + Integer getSupplierId(); + void setSupplierId(Integer supplierId); + } +} diff --git a/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/model/LegacyOrderPositionIdView.java b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/complex/model/LegacyOrderPositionIdView.java similarity index 93% rename from entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/model/LegacyOrderPositionIdView.java rename to entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/complex/model/LegacyOrderPositionIdView.java index f0a64fd732..605e209e3f 100644 --- a/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/model/LegacyOrderPositionIdView.java +++ b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/complex/model/LegacyOrderPositionIdView.java @@ -14,16 +14,13 @@ * limitations under the License. */ -package com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.model; +package com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.complex.model; import com.blazebit.persistence.view.EntityView; import com.blazebit.persistence.view.UpdatableEntityView; -import com.blazebit.persistence.view.UpdatableMapping; import com.blazebit.persistence.view.testsuite.entity.LegacyOrderPosition; import com.blazebit.persistence.view.testsuite.entity.LegacyOrderPositionId; -import java.util.Set; - /** * * @author Christian Beikov diff --git a/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/complex/model/UpdatableLegacyOrderPositionDefaultView.java b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/complex/model/UpdatableLegacyOrderPositionDefaultView.java new file mode 100644 index 0000000000..9dd9456450 --- /dev/null +++ b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/complex/model/UpdatableLegacyOrderPositionDefaultView.java @@ -0,0 +1,37 @@ +/* + * Copyright 2014 - 2018 Blazebit. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.complex.model; + +import com.blazebit.persistence.view.CreatableEntityView; +import com.blazebit.persistence.view.EntityView; +import com.blazebit.persistence.view.UpdatableEntityView; +import com.blazebit.persistence.view.testsuite.entity.LegacyOrderPositionDefault; + +/** + * + * @author Christian Beikov + * @since 1.2.0 + */ +@CreatableEntityView +@UpdatableEntityView +@EntityView(LegacyOrderPositionDefault.class) +public interface UpdatableLegacyOrderPositionDefaultView extends LegacyOrderPositionDefaultIdView { + + public String getValue(); + + public void setValue(String value); +} diff --git a/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/complex/model/UpdatableLegacyOrderPositionView.java b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/complex/model/UpdatableLegacyOrderPositionView.java new file mode 100644 index 0000000000..8f5a00464b --- /dev/null +++ b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/complex/model/UpdatableLegacyOrderPositionView.java @@ -0,0 +1,41 @@ +/* + * Copyright 2014 - 2018 Blazebit. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.complex.model; + +import com.blazebit.persistence.view.CreatableEntityView; +import com.blazebit.persistence.view.EntityView; +import com.blazebit.persistence.view.UpdatableEntityView; +import com.blazebit.persistence.view.UpdatableMapping; +import com.blazebit.persistence.view.testsuite.entity.LegacyOrderPosition; + +import java.util.Set; + +/** + * + * @author Christian Beikov + * @since 1.2.0 + */ +@CreatableEntityView +@UpdatableEntityView +@EntityView(LegacyOrderPosition.class) +public interface UpdatableLegacyOrderPositionView extends LegacyOrderPositionIdView { + + + @UpdatableMapping + Set getDefaults(); + void setDefaults(Set defaults); +} diff --git a/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/complex/model/UpdatableLegacyOrderView.java b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/complex/model/UpdatableLegacyOrderView.java new file mode 100644 index 0000000000..1c7ea4f385 --- /dev/null +++ b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/complex/model/UpdatableLegacyOrderView.java @@ -0,0 +1,43 @@ +/* + * Copyright 2014 - 2018 Blazebit. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.complex.model; + +import com.blazebit.persistence.view.CreatableEntityView; +import com.blazebit.persistence.view.EntityView; +import com.blazebit.persistence.view.InverseRemoveStrategy; +import com.blazebit.persistence.view.MappingInverse; +import com.blazebit.persistence.view.UpdatableEntityView; +import com.blazebit.persistence.view.UpdatableMapping; +import com.blazebit.persistence.view.testsuite.entity.LegacyOrder; + +import java.util.Set; + +/** + * + * @author Christian Beikov + * @since 1.2.0 + */ +@CreatableEntityView +@UpdatableEntityView +@EntityView(LegacyOrder.class) +public interface UpdatableLegacyOrderView extends LegacyOrderIdView { + + @MappingInverse(removeStrategy = InverseRemoveStrategy.REMOVE) + @UpdatableMapping + Set getPositions(); + void setPositions(Set positions); +} diff --git a/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/EntityViewUpdateSubviewInverseEmbeddedTest.java b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/simple/EntityViewUpdateSubviewInverseEmbeddedTest.java similarity index 95% rename from entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/EntityViewUpdateSubviewInverseEmbeddedTest.java rename to entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/simple/EntityViewUpdateSubviewInverseEmbeddedTest.java index 4bf664a685..9154152882 100644 --- a/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/EntityViewUpdateSubviewInverseEmbeddedTest.java +++ b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/simple/EntityViewUpdateSubviewInverseEmbeddedTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded; +package com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.simple; import com.blazebit.persistence.testsuite.base.jpa.assertion.AssertStatementBuilder; import com.blazebit.persistence.testsuite.base.jpa.category.NoDatanucleus; @@ -32,12 +32,12 @@ import com.blazebit.persistence.view.testsuite.entity.LegacyOrderPositionDefaultId; import com.blazebit.persistence.view.testsuite.entity.LegacyOrderPositionId; import com.blazebit.persistence.view.testsuite.update.AbstractEntityViewUpdateTest; -import com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.model.LegacyOrderIdView; -import com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.model.LegacyOrderPositionDefaultIdView; -import com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.model.LegacyOrderPositionIdView; -import com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.model.UpdatableLegacyOrderPositionDefaultView; -import com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.model.UpdatableLegacyOrderPositionView; -import com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.model.UpdatableLegacyOrderView; +import com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.simple.model.LegacyOrderIdView; +import com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.simple.model.LegacyOrderPositionDefaultIdView; +import com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.simple.model.LegacyOrderPositionIdView; +import com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.simple.model.UpdatableLegacyOrderPositionDefaultView; +import com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.simple.model.UpdatableLegacyOrderPositionView; +import com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.simple.model.UpdatableLegacyOrderView; import org.junit.Assert; import org.junit.Test; import org.junit.experimental.categories.Category; diff --git a/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/model/IdHolderView.java b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/simple/model/IdHolderView.java similarity index 96% rename from entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/model/IdHolderView.java rename to entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/simple/model/IdHolderView.java index 4188f26917..93667665f6 100644 --- a/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/model/IdHolderView.java +++ b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/simple/model/IdHolderView.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.model; +package com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.simple.model; import com.blazebit.persistence.view.IdMapping; diff --git a/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/model/LegacyOrderIdView.java b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/simple/model/LegacyOrderIdView.java similarity index 96% rename from entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/model/LegacyOrderIdView.java rename to entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/simple/model/LegacyOrderIdView.java index 83004eaf9f..b03fcca57c 100644 --- a/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/model/LegacyOrderIdView.java +++ b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/simple/model/LegacyOrderIdView.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.model; +package com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.simple.model; import com.blazebit.persistence.view.EntityView; import com.blazebit.persistence.view.testsuite.entity.LegacyOrder; diff --git a/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/model/LegacyOrderPositionDefaultIdView.java b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/simple/model/LegacyOrderPositionDefaultIdView.java similarity index 98% rename from entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/model/LegacyOrderPositionDefaultIdView.java rename to entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/simple/model/LegacyOrderPositionDefaultIdView.java index a04ba93120..66cba9496e 100644 --- a/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/model/LegacyOrderPositionDefaultIdView.java +++ b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/simple/model/LegacyOrderPositionDefaultIdView.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.model; +package com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.simple.model; import com.blazebit.persistence.view.EntityView; import com.blazebit.persistence.view.UpdatableEntityView; diff --git a/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/simple/model/LegacyOrderPositionIdView.java b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/simple/model/LegacyOrderPositionIdView.java new file mode 100644 index 0000000000..06fe5d9da2 --- /dev/null +++ b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/simple/model/LegacyOrderPositionIdView.java @@ -0,0 +1,42 @@ +/* + * Copyright 2014 - 2018 Blazebit. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.simple.model; + +import com.blazebit.persistence.view.EntityView; +import com.blazebit.persistence.view.UpdatableEntityView; +import com.blazebit.persistence.view.testsuite.entity.LegacyOrderPosition; +import com.blazebit.persistence.view.testsuite.entity.LegacyOrderPositionId; + +/** + * + * @author Christian Beikov + * @since 1.2.0 + */ +@EntityView(LegacyOrderPosition.class) +public interface LegacyOrderPositionIdView extends IdHolderView { + + @UpdatableEntityView + @EntityView(LegacyOrderPositionId.class) + interface Id { + + Long getOrderId(); + void setOrderId(Long orderId); + + Integer getPositionId(); + void setPositionId(Integer positionId); + } +} diff --git a/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/model/UpdatableLegacyOrderPositionDefaultView.java b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/simple/model/UpdatableLegacyOrderPositionDefaultView.java similarity index 97% rename from entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/model/UpdatableLegacyOrderPositionDefaultView.java rename to entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/simple/model/UpdatableLegacyOrderPositionDefaultView.java index 3494c468d6..bab68b2edc 100644 --- a/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/model/UpdatableLegacyOrderPositionDefaultView.java +++ b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/simple/model/UpdatableLegacyOrderPositionDefaultView.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.model; +package com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.simple.model; import com.blazebit.persistence.view.CreatableEntityView; import com.blazebit.persistence.view.EntityView; diff --git a/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/model/UpdatableLegacyOrderPositionView.java b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/simple/model/UpdatableLegacyOrderPositionView.java similarity index 97% rename from entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/model/UpdatableLegacyOrderPositionView.java rename to entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/simple/model/UpdatableLegacyOrderPositionView.java index 5c276ed2ed..509bb277d8 100644 --- a/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/model/UpdatableLegacyOrderPositionView.java +++ b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/simple/model/UpdatableLegacyOrderPositionView.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.model; +package com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.simple.model; import com.blazebit.persistence.view.CreatableEntityView; import com.blazebit.persistence.view.EntityView; diff --git a/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/model/UpdatableLegacyOrderView.java b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/simple/model/UpdatableLegacyOrderView.java similarity index 98% rename from entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/model/UpdatableLegacyOrderView.java rename to entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/simple/model/UpdatableLegacyOrderView.java index 754f82fb6a..689bff6abc 100644 --- a/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/model/UpdatableLegacyOrderView.java +++ b/entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/subview/inverse/embedded/simple/model/UpdatableLegacyOrderView.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.model; +package com.blazebit.persistence.view.testsuite.update.subview.inverse.embedded.simple.model; import com.blazebit.persistence.view.CreatableEntityView; import com.blazebit.persistence.view.EntityView; diff --git a/examples/deltaspike-data-rest/pom.xml b/examples/deltaspike-data-rest/pom.xml index 0808e56e92..12dd6e8f9c 100644 --- a/examples/deltaspike-data-rest/pom.xml +++ b/examples/deltaspike-data-rest/pom.xml @@ -187,6 +187,20 @@ false + + maven-jar-plugin + + + + default-jar + NONE + + + modular-jar + NONE + + + diff --git a/integration/datanucleus-5.1/pom.xml b/integration/datanucleus-5.1/pom.xml index 17af2bad2f..8a846079f6 100644 --- a/integration/datanucleus-5.1/pom.xml +++ b/integration/datanucleus-5.1/pom.xml @@ -158,6 +158,55 @@ + + + default-jar + package + + jar + + + + modular-jar + package + + jar + + + module + + + + + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + ${project.version}-module + + + module ${module.name} { + requires java.sql; + requires java.persistence; + requires org.datanucleus; + requires org.datanucleus.api.jpa; + requires com.blazebit.common.utils; + requires com.blazebit.persistence.core; + provides com.blazebit.persistence.spi.ExtendedQuerySupport with com.blazebit.persistence.integration.datanucleus.DataNucleus51ExtendedQuerySupport; + provides com.blazebit.persistence.spi.EntityManagerFactoryIntegrator with com.blazebit.persistence.integration.datanucleus.function.DataNucleus51EntityManagerFactoryIntegrator; + } + + + + + diff --git a/integration/datanucleus/pom.xml b/integration/datanucleus/pom.xml index 278d0c078d..e972d501b1 100644 --- a/integration/datanucleus/pom.xml +++ b/integration/datanucleus/pom.xml @@ -158,6 +158,55 @@ + + + default-jar + package + + jar + + + + modular-jar + package + + jar + + + module + + + + + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + ${project.version}-module + + + module ${module.name} { + requires java.sql; + requires java.persistence; + requires org.datanucleus; + requires org.datanucleus.api.jpa; + requires com.blazebit.common.utils; + requires com.blazebit.persistence.core; + provides com.blazebit.persistence.spi.ExtendedQuerySupport with com.blazebit.persistence.integration.datanucleus.DataNucleusExtendedQuerySupport; + provides com.blazebit.persistence.spi.EntityManagerFactoryIntegrator with com.blazebit.persistence.integration.datanucleus.function.DataNucleusEntityManagerFactoryIntegrator; + } + + + + + diff --git a/integration/deltaspike-data/api/pom.xml b/integration/deltaspike-data/api/pom.xml index 27b562080c..3952828b65 100644 --- a/integration/deltaspike-data/api/pom.xml +++ b/integration/deltaspike-data/api/pom.xml @@ -45,4 +45,37 @@ blaze-persistence-entity-view-api + + + + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + ${project.version}-module + + + module ${module.name} { + requires java.sql; + requires java.persistence; + requires java.enterprise.inject; + requires com.blazebit.persistence.view; + requires deltaspike.data.module.api; + exports com.blazebit.persistence.deltaspike.data; + } + + + + + + + + \ No newline at end of file diff --git a/integration/deltaspike-data/base/pom.xml b/integration/deltaspike-data/base/pom.xml index 1ee21dd3a8..46a8e0502d 100644 --- a/integration/deltaspike-data/base/pom.xml +++ b/integration/deltaspike-data/base/pom.xml @@ -109,6 +109,37 @@ + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + ${project.version}-module + + + module ${module.name} { + requires transitive java.enterprise.inject; + requires transitive com.blazebit.persistence.criteria.impl; + requires transitive deltaspike.data.module.api; + requires transitive deltaspike.data.module.impl; + exports com.blazebit.persistence.deltaspike.data.base.builder; + exports com.blazebit.persistence.deltaspike.data.base.builder.part; + exports com.blazebit.persistence.deltaspike.data.base.builder.postprocessor; + exports com.blazebit.persistence.deltaspike.data.base.criteria; + exports com.blazebit.persistence.deltaspike.data.base.handler; + } + + + + + + diff --git a/integration/deltaspike-data/base/src/main/java/com/blazebit/persistence/deltaspike/data/base/builder/QueryBuilderUtils.java b/integration/deltaspike-data/base/src/main/java/com/blazebit/persistence/deltaspike/data/base/builder/QueryBuilderUtils.java index bff8313234..991b236eb5 100644 --- a/integration/deltaspike-data/base/src/main/java/com/blazebit/persistence/deltaspike/data/base/builder/QueryBuilderUtils.java +++ b/integration/deltaspike-data/base/src/main/java/com/blazebit/persistence/deltaspike/data/base/builder/QueryBuilderUtils.java @@ -65,7 +65,7 @@ private QueryBuilderUtils() { if (pageable instanceof KeysetPageable) { setting.withKeysetPage(((KeysetPageable) pageable).getKeysetPage()); } - PaginatedCriteriaBuilder paginatedCriteriaBuilder = evm.applySetting(setting, cb); + PaginatedCriteriaBuilder paginatedCriteriaBuilder = (PaginatedCriteriaBuilder) evm.applySetting(setting, cb); if (keysetExtraction) { paginatedCriteriaBuilder.withKeysetExtraction(true); } diff --git a/integration/deltaspike-data/impl-1.7/pom.xml b/integration/deltaspike-data/impl-1.7/pom.xml index ad7e748a3c..5c3e153226 100644 --- a/integration/deltaspike-data/impl-1.7/pom.xml +++ b/integration/deltaspike-data/impl-1.7/pom.xml @@ -120,6 +120,31 @@ + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + ${project.version}-module + + + module ${module.name} { + requires transitive com.blazebit.persistence.integration.deltaspike.data; + exports com.blazebit.persistence.deltaspike.data.impl; + provides javax.enterprise.inject.spi.Extension with com.blazebit.persistence.deltaspike.data.impl.EntityViewRepositoryExtension; + } + + + + + + \ No newline at end of file diff --git a/integration/deltaspike-data/impl-1.8/pom.xml b/integration/deltaspike-data/impl-1.8/pom.xml index d66e025af9..2f3d0f48e6 100644 --- a/integration/deltaspike-data/impl-1.8/pom.xml +++ b/integration/deltaspike-data/impl-1.8/pom.xml @@ -125,6 +125,31 @@ + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + ${project.version}-module + + + module ${module.name} { + requires transitive com.blazebit.persistence.integration.deltaspike.data; + exports com.blazebit.persistence.deltaspike.data.impl; + provides javax.enterprise.inject.spi.Extension with com.blazebit.persistence.deltaspike.data.impl.EntityViewRepositoryExtension; + } + + + + + + \ No newline at end of file diff --git a/integration/deltaspike-data/rest/api/pom.xml b/integration/deltaspike-data/rest/api/pom.xml index 956bd59bb0..35261c2459 100644 --- a/integration/deltaspike-data/rest/api/pom.xml +++ b/integration/deltaspike-data/rest/api/pom.xml @@ -22,4 +22,34 @@ blaze-persistence-integration-deltaspike-data-api + + + + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + ${project.version}-module + + + module ${module.name} { + requires transitive java.ws.rs; + requires transitive com.blazebit.persistence.integration.deltaspike.data; + exports com.blazebit.persistence.deltaspike.data.rest; + } + + + + + + + + \ No newline at end of file diff --git a/integration/deltaspike-data/rest/impl/pom.xml b/integration/deltaspike-data/rest/impl/pom.xml index de43fe89d7..f63c3aafd3 100644 --- a/integration/deltaspike-data/rest/impl/pom.xml +++ b/integration/deltaspike-data/rest/impl/pom.xml @@ -43,6 +43,36 @@ + + + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + ${project.version}-module + + + module ${module.name} { + requires transitive com.blazebit.persistence.integration.deltaspike.data.rest; + requires com.blazebit.common.utils; + exports com.blazebit.persistence.deltaspike.data.rest.impl; + } + + + + + + + + + deltaspike-1.7 diff --git a/integration/eclipselink/pom.xml b/integration/eclipselink/pom.xml index 7cd2303f79..ef7dd61109 100644 --- a/integration/eclipselink/pom.xml +++ b/integration/eclipselink/pom.xml @@ -108,6 +108,33 @@ + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + ${project.version}-module + + + module ${module.name} { + requires java.sql; + requires java.persistence; + requires org.eclipse.persistence.jpa; + requires com.blazebit.persistence.core; + provides com.blazebit.persistence.spi.EntityManagerFactoryIntegrator with com.blazebit.persistence.integration.eclipselink.function.EclipseLinkEntityManagerIntegrator; + } + + + + + + diff --git a/integration/eclipselink/src/main/java/com/blazebit/persistence/integration/eclipselink/ObjectBuilderQueryRedirectorAdapter.java b/integration/eclipselink/src/main/java/com/blazebit/persistence/integration/eclipselink/ObjectBuilderQueryRedirectorAdapter.java deleted file mode 100644 index acf1e97da2..0000000000 --- a/integration/eclipselink/src/main/java/com/blazebit/persistence/integration/eclipselink/ObjectBuilderQueryRedirectorAdapter.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2014 - 2018 Blazebit. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.blazebit.persistence.integration.eclipselink; - -import com.blazebit.persistence.ObjectBuilder; -import org.eclipse.persistence.internal.sessions.AbstractRecord; -import org.eclipse.persistence.internal.sessions.AbstractSession; -import org.eclipse.persistence.queries.DatabaseQuery; -import org.eclipse.persistence.queries.QueryRedirector; -import org.eclipse.persistence.sessions.Record; -import org.eclipse.persistence.sessions.Session; - -import java.util.ArrayList; -import java.util.List; - -/** - * - * @author Christian Beikov - * @since 1.0.0 - */ -public class ObjectBuilderQueryRedirectorAdapter implements QueryRedirector { - - private static final long serialVersionUID = 1L; - - private final ObjectBuilder builder; - - public ObjectBuilderQueryRedirectorAdapter(ObjectBuilder builder) { - this.builder = builder; - } - - @Override - @SuppressWarnings({ "unchecked", "rawtypes" }) - public Object invokeQuery(DatabaseQuery query, Record arguments, Session session) { - List tupleList = (List) query.execute((AbstractSession) session, (AbstractRecord) arguments); - List results = new ArrayList(tupleList.size()); - - for (int i = 0; i < tupleList.size(); i++) { - Object tuple = tupleList.get(i); - - if (tuple instanceof Object[]) { - results.add(builder.build((Object[]) tuple)); - } else { - results.add(builder.build(new Object[]{ tuple })); - } - } - - return builder.buildList((List) results); - } -} diff --git a/integration/entity-view-cdi/pom.xml b/integration/entity-view-cdi/pom.xml index 8c5b9e84d4..2d891609b4 100644 --- a/integration/entity-view-cdi/pom.xml +++ b/integration/entity-view-cdi/pom.xml @@ -185,6 +185,33 @@ + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + ${project.version}-module + + + module ${module.name} { + requires java.sql; + requires java.persistence; + requires java.enterprise.inject; + requires com.blazebit.persistence.view; + provides javax.enterprise.inject.spi.Extension with com.blazebit.persistence.integration.view.cdi.EntityViewExtension; + } + + + + + + \ No newline at end of file diff --git a/integration/entity-view-spring/pom.xml b/integration/entity-view-spring/pom.xml index 32975c38f8..0cc0bbc227 100644 --- a/integration/entity-view-spring/pom.xml +++ b/integration/entity-view-spring/pom.xml @@ -84,4 +84,35 @@ test + + + + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + ${project.version}-module + + + module ${module.name} { + requires java.sql; + requires java.persistence; + requires spring.context; + requires com.blazebit.persistence.view; + } + + + + + + + + \ No newline at end of file diff --git a/integration/hibernate-4.2/pom.xml b/integration/hibernate-4.2/pom.xml index 35012babc8..912758d28a 100644 --- a/integration/hibernate-4.2/pom.xml +++ b/integration/hibernate-4.2/pom.xml @@ -102,6 +102,36 @@ + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + ${project.version}-module + + + module ${module.name} { + requires java.sql; + requires java.persistence; + requires org.hibernate.orm.core; + requires com.blazebit.persistence.core; + requires com.blazebit.persistence.integration.hibernate.base; + provides org.hibernate.integrator.spi.ServiceContributingIntegrator with com.blazebit.persistence.integration.hibernate.Hibernate4Integrator; + provides com.blazebit.persistence.integration.hibernate.base.HibernateAccess with com.blazebit.persistence.integration.hibernate.Hibernate4Access; + provides com.blazebit.persistence.spi.EntityManagerFactoryIntegrator with com.blazebit.persistence.integration.hibernate.Hibernate42EntityManagerFactoryIntegrator; + } + + + + + + diff --git a/integration/hibernate-4.3/pom.xml b/integration/hibernate-4.3/pom.xml index 928b406496..7ecf19d9f1 100644 --- a/integration/hibernate-4.3/pom.xml +++ b/integration/hibernate-4.3/pom.xml @@ -100,6 +100,36 @@ + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + ${project.version}-module + + + module ${module.name} { + requires java.sql; + requires java.persistence; + requires org.hibernate.orm.core; + requires com.blazebit.persistence.core; + requires com.blazebit.persistence.integration.hibernate.base; + provides org.hibernate.integrator.spi.ServiceContributingIntegrator with com.blazebit.persistence.integration.hibernate.Hibernate43Integrator; + provides com.blazebit.persistence.integration.hibernate.base.HibernateAccess with com.blazebit.persistence.integration.hibernate.Hibernate43Access; + provides com.blazebit.persistence.spi.EntityManagerFactoryIntegrator with com.blazebit.persistence.integration.hibernate.Hibernate43EntityManagerFactoryIntegrator; + } + + + + + + diff --git a/integration/hibernate-5.2/pom.xml b/integration/hibernate-5.2/pom.xml index 9ef8344a8c..41268bb31d 100644 --- a/integration/hibernate-5.2/pom.xml +++ b/integration/hibernate-5.2/pom.xml @@ -101,6 +101,36 @@ + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + ${project.version}-module + + + module ${module.name} { + requires java.sql; + requires java.persistence; + requires org.hibernate.orm.core; + requires com.blazebit.persistence.core; + requires com.blazebit.persistence.integration.hibernate.base; + provides org.hibernate.integrator.spi.ServiceContributingIntegrator with com.blazebit.persistence.integration.hibernate.Hibernate52Integrator; + provides com.blazebit.persistence.integration.hibernate.base.HibernateAccess with com.blazebit.persistence.integration.hibernate.Hibernate52Access; + provides com.blazebit.persistence.spi.EntityManagerFactoryIntegrator with com.blazebit.persistence.integration.hibernate.Hibernate52EntityManagerFactoryIntegrator; + } + + + + + + diff --git a/integration/hibernate-5.3/pom.xml b/integration/hibernate-5.3/pom.xml index 1999e4d914..bd526f290f 100644 --- a/integration/hibernate-5.3/pom.xml +++ b/integration/hibernate-5.3/pom.xml @@ -100,6 +100,36 @@ + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + ${project.version}-module + + + module ${module.name} { + requires java.sql; + requires java.persistence; + requires org.hibernate.orm.core; + requires com.blazebit.persistence.core; + requires com.blazebit.persistence.integration.hibernate.base; + provides org.hibernate.integrator.spi.ServiceContributingIntegrator with com.blazebit.persistence.integration.hibernate.Hibernate53Integrator; + provides com.blazebit.persistence.integration.hibernate.base.HibernateAccess with com.blazebit.persistence.integration.hibernate.Hibernate53Access; + provides com.blazebit.persistence.spi.EntityManagerFactoryIntegrator with com.blazebit.persistence.integration.hibernate.Hibernate53EntityManagerFactoryIntegrator; + } + + + + + + diff --git a/integration/hibernate-5/pom.xml b/integration/hibernate-5/pom.xml index 96771f24ec..e707d0b7a4 100644 --- a/integration/hibernate-5/pom.xml +++ b/integration/hibernate-5/pom.xml @@ -101,6 +101,36 @@ + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + ${project.version}-module + + + module ${module.name} { + requires java.sql; + requires java.persistence; + requires org.hibernate.orm.core; + requires com.blazebit.persistence.core; + requires com.blazebit.persistence.integration.hibernate.base; + provides org.hibernate.integrator.spi.ServiceContributingIntegrator with com.blazebit.persistence.integration.hibernate.Hibernate5Integrator; + provides com.blazebit.persistence.integration.hibernate.base.HibernateAccess with com.blazebit.persistence.integration.hibernate.Hibernate5Access; + provides com.blazebit.persistence.spi.EntityManagerFactoryIntegrator with com.blazebit.persistence.integration.hibernate.Hibernate5EntityManagerFactoryIntegrator; + } + + + + + + diff --git a/integration/hibernate-6.0/pom.xml b/integration/hibernate-6.0/pom.xml index 24a22159b0..bc4952c72e 100644 --- a/integration/hibernate-6.0/pom.xml +++ b/integration/hibernate-6.0/pom.xml @@ -111,6 +111,36 @@ + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + ${project.version}-module + + + module ${module.name} { + requires java.sql; + requires java.persistence; + requires org.hibernate.orm.core; + requires com.blazebit.persistence.core; + requires com.blazebit.persistence.integration.hibernate.base; + provides org.hibernate.integrator.spi.ServiceContributingIntegrator with com.blazebit.persistence.integration.hibernate.Hibernate60Integrator; + provides com.blazebit.persistence.integration.hibernate.base.HibernateAccess with com.blazebit.persistence.integration.hibernate.Hibernate60Access; + provides com.blazebit.persistence.spi.EntityManagerFactoryIntegrator with com.blazebit.persistence.integration.hibernate.Hibernate60EntityManagerFactoryIntegrator; + } + + + + + + diff --git a/integration/hibernate-base/pom.xml b/integration/hibernate-base/pom.xml index 9275612a2c..60e8c4f713 100644 --- a/integration/hibernate-base/pom.xml +++ b/integration/hibernate-base/pom.xml @@ -112,6 +112,38 @@ + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + ${project.version}-module + + + module ${module.name} { + requires java.sql; + requires java.persistence; + requires org.hibernate.orm.core; + requires com.blazebit.common.utils; + requires com.blazebit.persistence.core; + exports com.blazebit.persistence.integration.hibernate.base; + exports com.blazebit.persistence.integration.hibernate.base.spi; + uses com.blazebit.persistence.integration.hibernate.base.HibernateAccess; + uses com.blazebit.persistence.integration.hibernate.base.spi.HibernateVersionProvider; + provides com.blazebit.persistence.spi.ExtendedQuerySupport with com.blazebit.persistence.integration.hibernate.base.HibernateExtendedQuerySupport; + } + + + + + + diff --git a/integration/jpa-base/pom.xml b/integration/jpa-base/pom.xml index ae9c3c547b..416ebe25be 100644 --- a/integration/jpa-base/pom.xml +++ b/integration/jpa-base/pom.xml @@ -96,6 +96,32 @@ + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + ${project.version}-module + + + module ${module.name} { + requires java.sql; + requires java.persistence; + requires com.blazebit.persistence.core; + exports com.blazebit.persistence.integration.jpa.function; + } + + + + + + diff --git a/integration/openjpa/pom.xml b/integration/openjpa/pom.xml index 4c58e03248..2b87646140 100644 --- a/integration/openjpa/pom.xml +++ b/integration/openjpa/pom.xml @@ -101,6 +101,33 @@ + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + ${project.version}-module + + + module ${module.name} { + requires java.sql; + requires java.persistence; + requires org.openjpa; + requires com.blazebit.persistence.core; + provides com.blazebit.persistence.spi.EntityManagerFactoryIntegrator with com.blazebit.persistence.integration.openjpa.OpenJPAEntityManagerFactoryIntegrator; + } + + + + + + diff --git a/integration/openjpa/src/main/java/com/blazebit/persistence/integration/openjpa/OpenJPAEntityManagerIntegrator.java b/integration/openjpa/src/main/java/com/blazebit/persistence/integration/openjpa/OpenJPAEntityManagerFactoryIntegrator.java similarity index 96% rename from integration/openjpa/src/main/java/com/blazebit/persistence/integration/openjpa/OpenJPAEntityManagerIntegrator.java rename to integration/openjpa/src/main/java/com/blazebit/persistence/integration/openjpa/OpenJPAEntityManagerFactoryIntegrator.java index 2385182fc8..657cba9ab2 100644 --- a/integration/openjpa/src/main/java/com/blazebit/persistence/integration/openjpa/OpenJPAEntityManagerIntegrator.java +++ b/integration/openjpa/src/main/java/com/blazebit/persistence/integration/openjpa/OpenJPAEntityManagerFactoryIntegrator.java @@ -35,7 +35,7 @@ * @since 1.2.0 */ @ServiceProvider(EntityManagerFactoryIntegrator.class) -public class OpenJPAEntityManagerIntegrator implements EntityManagerFactoryIntegrator { +public class OpenJPAEntityManagerFactoryIntegrator implements EntityManagerFactoryIntegrator { private static final Logger LOG = Logger.getLogger(EntityManagerFactoryIntegrator.class.getName()); diff --git a/integration/spring-data/1.x/pom.xml b/integration/spring-data/1.x/pom.xml index fd89cdc980..d8fed5ad7b 100644 --- a/integration/spring-data/1.x/pom.xml +++ b/integration/spring-data/1.x/pom.xml @@ -93,4 +93,32 @@ + + + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + ${project.version}-module + + + module ${module.name} { + requires transitive com.blazebit.persistence.integration.spring.data.base; + } + + + + + + + + + \ No newline at end of file diff --git a/integration/spring-data/1.x/src/main/java/com/blazebit/persistence/spring/data/impl/repository/BlazePersistenceRepositoryFactory.java b/integration/spring-data/1.x/src/main/java/com/blazebit/persistence/spring/data/impl/repository/BlazePersistenceRepositoryFactory.java index 26efb860fe..34dffe120a 100644 --- a/integration/spring-data/1.x/src/main/java/com/blazebit/persistence/spring/data/impl/repository/BlazePersistenceRepositoryFactory.java +++ b/integration/spring-data/1.x/src/main/java/com/blazebit/persistence/spring/data/impl/repository/BlazePersistenceRepositoryFactory.java @@ -149,7 +149,7 @@ public RepositoryQuery resolveQuery(Method method, RepositoryMetadata metadata, try { // TODO: at some point, we might want to switch to the default if the repository doesn't contain entity views or keyset pagination return new PartTreeBlazePersistenceQuery(new EntityViewAwareJpaQueryMethod(method, (EntityViewAwareRepositoryMetadata) metadata, factory, provider), em, persistenceProvider, cbf, evm); - } catch (IllegalArgumentException e) { + } catch (RuntimeException e) { throw new IllegalArgumentException( String.format("Could not create query metamodel for method %s!", method.toString()), e); } diff --git a/integration/spring-data/2.x/pom.xml b/integration/spring-data/2.x/pom.xml index 56695368ff..3434a7e32f 100644 --- a/integration/spring-data/2.x/pom.xml +++ b/integration/spring-data/2.x/pom.xml @@ -95,4 +95,32 @@ + + + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + ${project.version}-module + + + module ${module.name} { + requires transitive com.blazebit.persistence.integration.spring.data.base; + } + + + + + + + + + \ No newline at end of file diff --git a/integration/spring-data/2.x/src/main/java/com/blazebit/persistence/spring/data/impl/repository/BlazePersistenceRepositoryFactory.java b/integration/spring-data/2.x/src/main/java/com/blazebit/persistence/spring/data/impl/repository/BlazePersistenceRepositoryFactory.java index 577010d45e..252937f2ed 100644 --- a/integration/spring-data/2.x/src/main/java/com/blazebit/persistence/spring/data/impl/repository/BlazePersistenceRepositoryFactory.java +++ b/integration/spring-data/2.x/src/main/java/com/blazebit/persistence/spring/data/impl/repository/BlazePersistenceRepositoryFactory.java @@ -185,7 +185,7 @@ public RepositoryQuery resolveQuery(Method method, RepositoryMetadata metadata, try { // TODO: at some point, we might want to switch to the default if the repository doesn't contain entity views or keyset pagination return new PartTreeBlazePersistenceQuery(new EntityViewAwareJpaQueryMethod(method, (EntityViewAwareRepositoryMetadata) metadata, factory, provider), em, persistenceProvider, cbf, evm); - } catch (IllegalArgumentException e) { + } catch (RuntimeException e) { throw new IllegalArgumentException( String.format("Could not create query metamodel for method %s!", method.toString()), e); } diff --git a/integration/spring-data/base/pom.xml b/integration/spring-data/base/pom.xml index b8350cb366..a47ea7ba58 100644 --- a/integration/spring-data/base/pom.xml +++ b/integration/spring-data/base/pom.xml @@ -80,6 +80,40 @@ + + + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + ${project.version}-module + + + module ${module.name} { + requires transitive spring.context; + requires transitive spring.data; + requires transitive com.blazebit.persistence.criteria.impl; + exports com.blazebit.persistence.spring.data.base; + exports com.blazebit.persistence.spring.data.base.query; + exports com.blazebit.persistence.spring.data.base.repository; + exports com.blazebit.persistence.spring.data.repository; + } + + + + + + + + + diff --git a/integration/spring-data/base/src/main/java/org/springframework/data/jpa/repository/query/FixedJpaQueryCreator.java b/integration/spring-data/base/src/main/java/org/springframework/data/jpa/repository/query/FixedJpaQueryCreator.java index a8ae63825d..7a46a5a0f8 100644 --- a/integration/spring-data/base/src/main/java/org/springframework/data/jpa/repository/query/FixedJpaQueryCreator.java +++ b/integration/spring-data/base/src/main/java/org/springframework/data/jpa/repository/query/FixedJpaQueryCreator.java @@ -161,7 +161,7 @@ public PredicateBuilder(Part part, Root root) { * * @return */ - public Predicate build() { + public Predicate build() { PropertyPath property = part.getProperty(); Part.Type type = part.getType(); @@ -207,8 +207,8 @@ public Predicate build() { if (property.getLeafProperty().isCollection()) { - Expression> propertyExpression = traversePath(root, property); - Expression parameterExpression = provider.next(part).getExpression(); + Expression> propertyExpression = traversePath(root, property); + Expression parameterExpression = (Expression) provider.next(part).getExpression(); // Can't just call .not() in case of negation as EclipseLink chokes on that. return type.equals(NOT_CONTAINING) ? builder.isNotMember(parameterExpression, propertyExpression) diff --git a/integration/spring-data/rest/pom.xml b/integration/spring-data/rest/pom.xml index ba1986896f..07500f73ca 100644 --- a/integration/spring-data/rest/pom.xml +++ b/integration/spring-data/rest/pom.xml @@ -62,6 +62,35 @@ + + + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + ${project.version}-module + + + module ${module.name} { + requires transitive com.blazebit.persistence.integration.spring.data.base; + exports com.blazebit.persistence.spring.data.rest; + } + + + + + + + + + diff --git a/jpa-criteria/api/pom.xml b/jpa-criteria/api/pom.xml index af76026ebb..e54d770ec4 100644 --- a/jpa-criteria/api/pom.xml +++ b/jpa-criteria/api/pom.xml @@ -53,4 +53,33 @@ provided + + + + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + ${project.version}-module + + + module ${module.name} { + requires transitive com.blazebit.persistence.core; + exports com.blazebit.persistence.criteria; + } + + + + + + + + diff --git a/jpa-criteria/impl/pom.xml b/jpa-criteria/impl/pom.xml index 5ecfbbf15a..ca34a9ad71 100644 --- a/jpa-criteria/impl/pom.xml +++ b/jpa-criteria/impl/pom.xml @@ -121,6 +121,31 @@ + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + ${project.version}-module + + + module ${module.name} { + requires com.blazebit.common.utils; + requires transitive com.blazebit.persistence.criteria; + exports com.blazebit.persistence.criteria.impl; + } + + + + + + diff --git a/jpa-criteria/impl/src/main/java/com/blazebit/persistence/criteria/impl/path/AbstractFrom.java b/jpa-criteria/impl/src/main/java/com/blazebit/persistence/criteria/impl/path/AbstractFrom.java index 42592b629c..685f206a30 100644 --- a/jpa-criteria/impl/src/main/java/com/blazebit/persistence/criteria/impl/path/AbstractFrom.java +++ b/jpa-criteria/impl/src/main/java/com/blazebit/persistence/criteria/impl/path/AbstractFrom.java @@ -231,7 +231,7 @@ private void checkJoin(Attribute attribute, JoinType jt) { @Override @SuppressWarnings({"unchecked"}) public Set> getJoins() { - return joins == null ? Collections.EMPTY_SET : joins; + return joins == null ? Collections.EMPTY_SET : (Set>) (Set) joins; } @Override @@ -475,7 +475,7 @@ protected void checkFetchAllowed() { @Override @SuppressWarnings({"unchecked"}) public Set> getFetches() { - return fetches == null ? Collections.EMPTY_SET : fetches; + return fetches == null ? Collections.EMPTY_SET : (Set>) (Set) fetches; } @Override diff --git a/parent/pom.xml b/parent/pom.xml index 3ceb70d351..0d589f4afc 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -89,6 +89,7 @@ 3.3.2 1.0.2 + 1.0.0.Beta1 2.5.1 2.19.1 @@ -434,6 +435,14 @@ + + org.moditect + moditect-maven-plugin + ${version.moditect.plugin} + + true + + diff --git a/pom.xml b/pom.xml index 28607352c2..0c7da25abf 100644 --- a/pom.xml +++ b/pom.xml @@ -33,7 +33,13 @@ Blazebit Blaze-Persistence + ${env.JAVA_HOME} + ${jdk8.home}${file.separator}jre${file.separator}lib${file.separator}rt.jar + 1.7 + ${java.version} + ${java.version} 8.7 + 3.3.1 yyyy ${maven.build.timestamp} @@ -97,9 +103,9 @@ - cchet - Thomas Herzog - t.herzog@curecomp.com + Mobe91 + Moritz Becker + m.becker@curecomp.com Curecomp http://www.curecomp.com UTC+1 @@ -108,11 +114,11 @@ - Mobe91 - Moritz Becker - m.becker@curecomp.com - Curecomp - http://www.curecomp.com + JWGmeligMeyling + Jan-Willem Gmelig Meyling + j.gmeligmeyling@student.tudelft.nl + Young Media Experts + http://youngmediaexperts.nl/ UTC+1 Committer @@ -120,6 +126,34 @@ + + normal-jdk-jar + + + !mac + + + ${jdk8.home}${file.separator}jre${file.separator}lib${file.separator}rt.jar + + + + ${jdk8.home}${file.separator}jre${file.separator}lib${file.separator}rt.jar + + + + mac-jdk-jar + + + mac + + + ${jdk8.home}${file.separator}jre${file.separator}lib${file.separator}classes.jar + + + + classes.jar + + javadoc-xdoclint-disable-jdk8+ @@ -158,8 +192,44 @@ + + jdk11+ + + [11,) + + + + + org.apache.maven.plugins + maven-enforcer-plugin + + + enforce-jdk8-available + + enforce + + + + + To build this project with JDK 11+ you need to provide a system property "jdk8.home" that can be used to access the rt.jar + + ${jdk8.classes.jar} + + + + + + + + + + blazebit-release + + + 1.9 + parent core @@ -269,7 +339,28 @@ - org.apache.maven.plugins + maven-jar-plugin + + + default-jar + package + + jar + + + + modular-jar + package + + jar + + + module + + + + + maven-release-plugin false diff --git a/roadmap.asciidoc b/roadmap.asciidoc index 5dd6743023..da6ea4c6d4 100644 --- a/roadmap.asciidoc +++ b/roadmap.asciidoc @@ -50,7 +50,7 @@ As a side note, we are naming releases after http://marvel.com/comics/characters = 1.3 Fury -_Scheduled for end of April 2018_ +_Scheduled for end of June 2018_ because of long holiday trips ** EMBEDDING_VIEW function support ** Use of entity collection DML for updatable entity views diff --git a/testsuite-base/datanucleus/pom.xml b/testsuite-base/datanucleus/pom.xml index 0bab9cc4ab..33b091397c 100644 --- a/testsuite-base/datanucleus/pom.xml +++ b/testsuite-base/datanucleus/pom.xml @@ -90,6 +90,25 @@ + + + default-jar + package + + jar + + + + modular-jar + package + + jar + + + module + + + diff --git a/travis/install_latest_maven.sh b/travis/install_latest_maven.sh deleted file mode 100644 index a658dc9142..0000000000 --- a/travis/install_latest_maven.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -e - -# Download and install newest maven -mkdir /tmp/apache-maven -curl -fSL http://apache.mirrors.ovh.net/ftp.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz -o maven.tar.gz \ - && tar -xvf maven.tar.gz -C /tmp/apache-maven --strip-components=1 \ - && rm maven.tar.gz* \ No newline at end of file