diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 68d9e3a7..6d1a9816 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -6,18 +6,23 @@ on:
pull_request:
branches: [ master ]
+env:
+ JAVA_VERSION: '17'
+
jobs:
build:
name: DBRider Build
runs-on: ubuntu-22.04
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v4
- name: Set up JDK
- uses: actions/setup-java@v3.1.1
+ uses: actions/setup-java@v4
with:
distribution: 'temurin'
- java-version: '11'
+ java-version: ${{ env.JAVA_VERSION }}
+ cache: 'maven'
- uses: actions/cache@v4
+ if: false
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
@@ -30,13 +35,15 @@ jobs:
runs-on: ubuntu-22.04
needs: build
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v4
- name: Set up JDK
- uses: actions/setup-java@v3.1.1
+ uses: actions/setup-java@v4
with:
distribution: 'temurin'
- java-version: '11'
+ java-version: ${{ env.JAVA_VERSION }}
+ cache: 'maven'
- uses: actions/cache@v4
+ if: false
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
@@ -66,18 +73,20 @@ jobs:
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASS: ${{ secrets.MAVEN_PASS }}
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v4
- name: Set up JDK
- uses: actions/setup-java@v3.1.1
+ uses: actions/setup-java@v4
with:
distribution: 'temurin'
- java-version: '11'
+ java-version: ${{ env.JAVA_VERSION }}
server-id: releases
server-username: MAVEN_USER
server-password: MAVEN_PASS
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: GPG_PASSPHRASE
+ cache: 'maven'
- uses: actions/cache@v4
+ if: false
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
diff --git a/.sdkmanrc b/.sdkmanrc
index 453ebb99..38c438f7 100644
--- a/.sdkmanrc
+++ b/.sdkmanrc
@@ -1,4 +1,4 @@
# Enable auto-env through the sdkman_auto_env config
# Add key=value pairs of SDKs to use below
-java=11.0.24-tem
-maven=3.9.1
+java=17.0.14-tem
+maven=3.9.13
diff --git a/MIGRATION_NEXT_STEPS.md b/MIGRATION_NEXT_STEPS.md
new file mode 100644
index 00000000..5adb38e7
--- /dev/null
+++ b/MIGRATION_NEXT_STEPS.md
@@ -0,0 +1,215 @@
+# Database Rider 2.0 Follow-Up Migration Plan
+
+This document captures the work intentionally deferred after the first 2.0 modernization tranche.
+
+## Current Cut
+
+The current branch delivers:
+
+- Java 17 as the CI and active modernization baseline
+- refreshed build and dependency management in the parent reactor
+- Spring Framework 6 / Spring Boot 3 migration for the main Spring-facing path
+- Kotlin sample migration to Kotlin 2.3 and Jakarta persistence
+- Jakarta verification path passing with:
+ - `mvn -q -Pjakarta -Dmaven.repo.local=/tmp/database-rider-m2 verify -Pcoverage`
+
+The remaining work should continue as follow-up stages instead of being folded into the current commit.
+
+## Stage A: Finish the Spring Boot 3 migration
+
+### 1. Restore the disabled Spring Boot sample flow
+
+File:
+
+- `rider-examples/spring-boot-dbunit-sample/src/test/java/com/github/database/rider/springboot/SpringBootDBUnitTest.java`
+
+Current status:
+
+- completed on `codex/database-rider-2-modernization`
+- the sample now uses the same `cacheConnection = false` Boot 3 pattern as the working multi-datasource test path
+
+Follow-up:
+
+- keep the test green as the Spring tranche continues
+- use it as the baseline regression path for future Spring Boot 3 changes
+
+### 2. Revisit Data JPA rollback coverage
+
+File:
+
+- `rider-examples/spring-boot-dbunit-sample/src/test/java/com/github/database/rider/springboot/SpringBootDataJpaRollbackTest.java`
+
+Current status:
+
+- completed on `codex/database-rider-2-modernization`
+- the sample now verifies rollback semantics directly in a Boot 3 `@DataJpaTest` slice using an `@AfterTransaction` RiderDSL assertion
+
+Follow-up:
+
+- if desired later, add a separate committed-transaction slice example for `@ExpectedDataSet`
+- keep rollback coverage focused on the transactional behavior that `@DataJpaTest` actually guarantees
+
+## Stage B: Modernize the deferred example modules
+
+### 3. Migrate `jpa-productivity-boosters`
+
+Files:
+
+- `rider-examples/jpa-productivity-boosters`
+
+Current status:
+
+- still in the legacy example reactor
+- not part of the Jakarta verification path
+
+Next work:
+
+- audit DeltaSpike/CDI/test infrastructure for Java 17 and Jakarta compatibility
+- migrate `javax.*` persistence, validation, and CDI imports where feasible
+- decide whether this module remains an actively supported 2.0 example or moves into a clearly labeled legacy bucket
+
+### 4. Finish the `jOOQ-DBUnit-flyway-example` modernization
+
+Files:
+
+- `rider-examples/jOOQ-DBUnit-flyway-example`
+
+Current status:
+
+- Flyway API usage was updated enough to keep the code aligned with the new baseline
+- the module is still not part of the Jakarta verification path
+
+Next work:
+
+- upgrade the example to a current jOOQ-compatible stack on Java 17
+- align JDBC/Testcontainers/Flyway settings with the parent version model
+- re-enable verification as part of the modern example path when stable
+
+### 5. Review `dbunit-tomee-appcomposer-sample`
+
+Files:
+
+- `rider-examples/dbunit-tomee-appcomposer-sample`
+
+Current status:
+
+- still treated as a legacy example
+
+Next work:
+
+- determine whether Tomee/AppComposer remains a supported 2.0 example
+- if yes, migrate it to the Java 17 toolchain and verify it still demonstrates meaningful coverage
+- if not, move it behind an explicit legacy profile or document it as no longer maintained
+
+## Stage C: Quarkus migration
+
+### 6. Upgrade Quarkus examples to Quarkus 3.x
+
+Files:
+
+- `rider-examples/quarkus-dbunit-sample`
+- `rider-examples/quarkus-postgres-sample`
+
+Current status:
+
+- still on older Quarkus-era assumptions
+- not yet part of the Jakarta modernization path
+
+Next work:
+
+- upgrade to a supported Quarkus 3.x line on Java 17
+- migrate imports and configuration to Jakarta APIs
+- update test infrastructure and datasource wiring
+- re-evaluate disabled coverage in:
+ - `rider-examples/quarkus-dbunit-sample/src/test/java/com/github/quarkus/sample/QuarkusMultipleDataSourceTest.java`
+
+Desired exit criteria:
+
+- at least one Quarkus sample passes in the modern verification path
+- multiple datasource behavior is either restored or explicitly documented as deferred
+
+## Stage D: Micronaut migration
+
+### 7. Upgrade Micronaut example to Micronaut 4.x
+
+Files:
+
+- `rider-examples/rider-micronaut`
+- `rider-junit5/src/main/java/com/github/database/rider/junit5/integration/Micronaut.java`
+
+Current status:
+
+- Micronaut example still contains JCenter-era configuration
+- not part of the current Jakarta verification path
+
+Next work:
+
+- remove JCenter from Maven and Gradle build files
+- upgrade to Micronaut 4.x on Java 17
+- update test extension usage to current Micronaut JUnit 5 APIs
+- verify the JUnit 5 Micronaut integration still resolves connections correctly against the upgraded example
+
+## Stage E: Artifact and profile policy cleanup
+
+### 8. Finalize 2.0 artifact policy
+
+Current status:
+
+- the modernization branch behaves as Jakarta-first for the actively maintained framework path
+- legacy modules still exist in parallel
+
+Next work:
+
+- define whether 2.0 keeps dual-mode publication in `rider-core` only
+- define whether framework-facing integrations are Jakarta-first only
+- align README and module docs around one clear artifact/classifier story
+
+### 9. Replace the temporary example-reactor split with a durable profile strategy
+
+File:
+
+- `rider-examples/pom.xml`
+
+Current status:
+
+- `legacy-examples` is active by default
+- `jakarta` currently includes only the modernized Spring and Kotlin examples
+
+Next work:
+
+- keep this split while migrations are in flight
+- once Quarkus, Micronaut, and retained legacy examples are triaged, replace the transitional setup with a clearer long-term profile model
+
+Possible end state:
+
+- `modern-examples`
+- `legacy-examples`
+- optional framework-specific profiles if the matrix remains too large for one default verification path
+
+## Stage F: Documentation and release framing
+
+### 10. Expand the 2.0 migration guidance
+
+Files:
+
+- `README.adoc`
+- module READMEs
+- changelog / release notes
+
+Next work:
+
+- add a full upgrade guide for users moving from 1.x
+- document Java 17 as the baseline
+- document Spring 6 / Boot 3 expectations
+- document Jakarta package migration and classifier usage
+- explicitly list deferred example migrations so the staged release shape is clear
+
+## Recommended Execution Order
+
+1. Commit the current modernization tranche.
+2. Restore the disabled Spring Boot test coverage.
+3. Modernize Quarkus examples.
+4. Modernize the Micronaut example and integration edge.
+5. Triage and migrate or isolate `jpa-productivity-boosters`, `jOOQ`, and Tomee.
+6. Finalize artifact/profile policy.
+7. Refresh docs and rerun the full verification strategy for the updated matrix.
diff --git a/README.adoc b/README.adoc
index 2e3f4ad2..6f8a8fb0 100644
--- a/README.adoc
+++ b/README.adoc
@@ -38,6 +38,18 @@ Watch https://www.youtube.com/watch?v=A5ryED3a8FY[1.0 promo video^] to get an id
A lot of this work is based on https://github.com/arquillian/arquillian-extension-persistence/[Arquillian persistence extension] and focus on simplicity (one dependency - dbunit).
+== 2.0 Migration Status
+
+The current modernization branch targets Java 17 as the baseline for CI and the actively maintained examples.
+
+For Spring Boot 3 / Spring Framework 6 / Jakarta users:
+
+- build the Spring and Kotlin sample tranche with `-Pjakarta`
+- use the `jakarta` classifier for `rider-core` and `rider-junit5`
+- expect Jakarta namespace imports such as `jakarta.persistence.*`
+
+The remaining Quarkus, Micronaut, and older example migrations are follow-up stages in the 2.0 release train.
+
== Introduction
diff --git a/pom.xml b/pom.xml
index b885cd24..bd902270 100644
--- a/pom.xml
+++ b/pom.xml
@@ -55,33 +55,61 @@
- tranvis-ci.org
- https://travis-ci.org/database-rider/database-rider
+ GitHub Actions
+ https://github.com/database-rider/database-rider/actions
UTF-8
- 0.8.7
+ 17
+ true
+ false
+ 0.8.12
1.9.6
- 3.0.0-M7
- 1.17.3
- 2.13.3
+ 3.14.0
+ 3.1.4
+ 3.11.2
+ 3.1.1
+ 3.5.2
+ --add-opens java.base/java.util=ALL-UNNAMED
+ 2.3.10
+ 6.2.0
+ 3.5.0
+ 5.13.4
+ 1.13.4
+ 4.13.2
+ 1.20.6
+ 2.18.3
0.20.9
- 1.7.36
+ 2.0.17
+ 4.3.11.Final
+ 6.2.3.Final
+ 2.5.2
+ 4.0.1
+ 10.20.1
+ 5.15.2
+ 2.7.4
+ 2.3.232
+ 42.7.5
+ 12.8.1.jre11
+ 8.4.0
+ 1.3.6
+ 1.2.0
+ 3.27.2
junit
junit
- 4.13.2
+ ${junit4.version}
provided
org.hsqldb
hsqldb
- 2.6.1
+ ${hsqldb.version}
test
@@ -137,6 +165,31 @@
jackson-databind
${jackson.version}
+
+ org.junit.jupiter
+ junit-jupiter-api
+ ${junit.jupiter.version}
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+ ${junit.jupiter.version}
+
+
+ org.junit.jupiter
+ junit-jupiter-params
+ ${junit.jupiter.version}
+
+
+ org.junit.platform
+ junit-platform-commons
+ ${junit.platform.version}
+
+
+ org.junit.platform
+ junit-platform-runner
+ ${junit.platform.version}
+
org.yaml
snakeyaml
@@ -161,10 +214,10 @@
org.apache.maven.plugins
maven-compiler-plugin
- 3.8.1
+ ${compiler.plugin.version}
- 1.8
- 1.8
+ ${maven.compiler.release}
+ ${maven.compiler.parameters}
UTF-8
@@ -172,6 +225,7 @@
org.apache.maven.plugins
maven-surefire-plugin
+ ${surefire.addOpens}
**/*It.java
**/*Test.java
@@ -187,7 +241,7 @@
maven-release-plugin
- 3.0.0-M7
+ ${release.plugin.version}
false
release
@@ -205,18 +259,38 @@
org.apache.maven.plugins
maven-deploy-plugin
- 2.8.2
+ ${deploy.plugin.version}
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ ${compiler.plugin.version}
org.apache.maven.plugins
maven-surefire-plugin
${surefire.version}
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ ${javadoc.plugin.version}
+
+
+ maven-release-plugin
+ ${release.plugin.version}
+
+
+ jakarta
+
+ true
+
+
coverage
diff --git a/rider-cdi/pom.xml b/rider-cdi/pom.xml
index 63b1b3e0..ddefacec 100644
--- a/rider-cdi/pom.xml
+++ b/rider-cdi/pom.xml
@@ -39,15 +39,21 @@
org.hibernate
hibernate-core
- 4.3.5.Final
+ ${hibernate.javax.version}
provided
org.eclipse.persistence
eclipselink
- 2.5.2
+ ${eclipselink.javax.version}
provided
+
+ javax.validation
+ validation-api
+ 2.0.1.Final
+ test
+
@@ -130,16 +136,22 @@
jakarta.enterprise.cdi-api
4.0.1
+
+ jakarta.validation
+ jakarta.validation-api
+ 3.1.0
+ test
+
org.hibernate
hibernate-core
- 6.2.3.Final
+ ${hibernate.jakarta.version}
provided
org.eclipse.persistence
eclipselink
- 4.0.1
+ ${eclipselink.jakarta.version}
provided
diff --git a/rider-cdi/src/main/java/com/github/database/rider/cdi/DataSetProcessor.java b/rider-cdi/src/main/java/com/github/database/rider/cdi/DataSetProcessor.java
index 124cea4a..41fd6c2b 100644
--- a/rider-cdi/src/main/java/com/github/database/rider/cdi/DataSetProcessor.java
+++ b/rider-cdi/src/main/java/com/github/database/rider/cdi/DataSetProcessor.java
@@ -14,7 +14,6 @@
import com.github.database.rider.core.replacers.Replacer;
import org.dbunit.DatabaseUnitException;
import org.hibernate.Session;
-import org.hibernate.internal.SessionImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -90,7 +89,7 @@ private Connection createConnection(String entityManagerBeanName) {
return jtaConnectionHolder.get().getConnection(entityManagerBeanName);
} else {
if (isHibernatePresentOnClasspath() && entityManager.getDelegate() instanceof Session) {
- connection = ((SessionImpl) entityManager.unwrap(Session.class)).connection();
+ connection = entityManager.unwrap(Session.class).doReturningWork(returningConnection -> returningConnection);
} else {
/**
* see here:http://wiki.eclipse.org/EclipseLink/Examples/JPA/EMAPI#Getting_a_JDBC_Connection_from_an_EntityManager
@@ -205,4 +204,4 @@ public void afterTest(String datasource) {
public EntityManager getEntityManager() {
return entityManager;
}
-}
\ No newline at end of file
+}
diff --git a/rider-cdi/src/main/java/com/github/database/rider/cdi/JakartaDataSetProcessor.jv b/rider-cdi/src/main/java/com/github/database/rider/cdi/JakartaDataSetProcessor.jv
index c5760919..dd9f8b65 100644
--- a/rider-cdi/src/main/java/com/github/database/rider/cdi/JakartaDataSetProcessor.jv
+++ b/rider-cdi/src/main/java/com/github/database/rider/cdi/JakartaDataSetProcessor.jv
@@ -88,8 +88,8 @@ public class DataSetProcessor {
return jtaConnectionHolder.get().getConnection(entityManagerBeanName);
} else {
if (isHibernatePresentOnClasspath()) {
- connection = entityManager.unwrap(org.hibernate.engine.spi.SessionImplementor.class).getJdbcConnectionAccess().obtainConnection()
- ;
+ connection = entityManager.unwrap(org.hibernate.Session.class)
+ .doReturningWork(returningConnection -> returningConnection);
} else {
/**
* see here:http://wiki.eclipse.org/EclipseLink/Examples/JPA/EMAPI#Getting_a_JDBC_Connection_from_an_EntityManager
@@ -204,4 +204,4 @@ public class DataSetProcessor {
public EntityManager getEntityManager() {
return entityManager;
}
-}
\ No newline at end of file
+}
diff --git a/rider-cdi/src/test/java/com/github/database/rider/cdi/BeforeAndAfterTest.java b/rider-cdi/src/test/java/com/github/database/rider/cdi/BeforeAndAfterTest.java
index 99c952eb..931334b6 100644
--- a/rider-cdi/src/test/java/com/github/database/rider/cdi/BeforeAndAfterTest.java
+++ b/rider-cdi/src/test/java/com/github/database/rider/cdi/BeforeAndAfterTest.java
@@ -10,9 +10,9 @@
import org.junit.Test;
import org.junit.runner.RunWith;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.persistence.EntityManager;
+import jakarta.inject.Inject;
+import jakarta.inject.Named;
+import jakarta.persistence.EntityManager;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/rider-cdi/src/test/java/com/github/database/rider/cdi/CrudCDIIt.java b/rider-cdi/src/test/java/com/github/database/rider/cdi/CrudCDIIt.java
index 20838c31..501e11e4 100644
--- a/rider-cdi/src/test/java/com/github/database/rider/cdi/CrudCDIIt.java
+++ b/rider-cdi/src/test/java/com/github/database/rider/cdi/CrudCDIIt.java
@@ -13,8 +13,8 @@
import org.junit.Test;
import org.junit.runner.RunWith;
-import javax.inject.Inject;
-import javax.persistence.EntityManager;
+import jakarta.inject.Inject;
+import jakarta.persistence.EntityManager;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
@@ -124,4 +124,4 @@ public IDataSet provide() throws DataSetException {
return builder.build();
}
}
-}
\ No newline at end of file
+}
diff --git a/rider-cdi/src/test/java/com/github/database/rider/cdi/DBRiderInterceptorIt.java b/rider-cdi/src/test/java/com/github/database/rider/cdi/DBRiderInterceptorIt.java
index cf9004b5..d596ea23 100644
--- a/rider-cdi/src/test/java/com/github/database/rider/cdi/DBRiderInterceptorIt.java
+++ b/rider-cdi/src/test/java/com/github/database/rider/cdi/DBRiderInterceptorIt.java
@@ -11,8 +11,8 @@
import org.junit.Test;
import org.junit.runner.RunWith;
-import javax.inject.Inject;
-import javax.persistence.EntityManager;
+import jakarta.inject.Inject;
+import jakarta.persistence.EntityManager;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
@@ -120,4 +120,4 @@ public IDataSet provide() throws DataSetException {
return builder.build();
}
}
-}
\ No newline at end of file
+}
diff --git a/rider-cdi/src/test/java/com/github/database/rider/cdi/DBUnitCDIIt.java b/rider-cdi/src/test/java/com/github/database/rider/cdi/DBUnitCDIIt.java
index 087e2f26..43504b56 100644
--- a/rider-cdi/src/test/java/com/github/database/rider/cdi/DBUnitCDIIt.java
+++ b/rider-cdi/src/test/java/com/github/database/rider/cdi/DBUnitCDIIt.java
@@ -10,8 +10,8 @@
import org.junit.Test;
import org.junit.runner.RunWith;
-import javax.inject.Inject;
-import javax.persistence.EntityManager;
+import jakarta.inject.Inject;
+import jakarta.persistence.EntityManager;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/rider-cdi/src/test/java/com/github/database/rider/cdi/DataSetProviderIt.java b/rider-cdi/src/test/java/com/github/database/rider/cdi/DataSetProviderIt.java
index 745f0e76..abb4dd41 100644
--- a/rider-cdi/src/test/java/com/github/database/rider/cdi/DataSetProviderIt.java
+++ b/rider-cdi/src/test/java/com/github/database/rider/cdi/DataSetProviderIt.java
@@ -17,8 +17,8 @@
import org.junit.Test;
import org.junit.runner.RunWith;
-import javax.inject.Inject;
-import javax.persistence.EntityManager;
+import jakarta.inject.Inject;
+import jakarta.persistence.EntityManager;
import java.util.List;
import static com.github.database.rider.core.util.EntityManagerProvider.em;
diff --git a/rider-cdi/src/test/java/com/github/database/rider/cdi/ExecuteScriptsIt.java b/rider-cdi/src/test/java/com/github/database/rider/cdi/ExecuteScriptsIt.java
index 611ffbcd..81030b39 100644
--- a/rider-cdi/src/test/java/com/github/database/rider/cdi/ExecuteScriptsIt.java
+++ b/rider-cdi/src/test/java/com/github/database/rider/cdi/ExecuteScriptsIt.java
@@ -10,8 +10,8 @@
import org.junit.Test;
import org.junit.runner.RunWith;
-import javax.inject.Inject;
-import javax.persistence.EntityManager;
+import jakarta.inject.Inject;
+import jakarta.persistence.EntityManager;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/rider-cdi/src/test/java/com/github/database/rider/cdi/ExpectedDataSetCDIIt.java b/rider-cdi/src/test/java/com/github/database/rider/cdi/ExpectedDataSetCDIIt.java
index 542ba018..3b66900f 100644
--- a/rider-cdi/src/test/java/com/github/database/rider/cdi/ExpectedDataSetCDIIt.java
+++ b/rider-cdi/src/test/java/com/github/database/rider/cdi/ExpectedDataSetCDIIt.java
@@ -11,8 +11,8 @@
import org.junit.Test;
import org.junit.runner.RunWith;
-import javax.inject.Inject;
-import javax.persistence.EntityManager;
+import jakarta.inject.Inject;
+import jakarta.persistence.EntityManager;
import java.util.Random;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/rider-cdi/src/test/java/com/github/database/rider/cdi/ExportDataSetCDIIt.java b/rider-cdi/src/test/java/com/github/database/rider/cdi/ExportDataSetCDIIt.java
index fb0eb977..b42ceb88 100644
--- a/rider-cdi/src/test/java/com/github/database/rider/cdi/ExportDataSetCDIIt.java
+++ b/rider-cdi/src/test/java/com/github/database/rider/cdi/ExportDataSetCDIIt.java
@@ -4,8 +4,8 @@
import java.io.File;
-import javax.inject.Inject;
-import javax.persistence.EntityManager;
+import jakarta.inject.Inject;
+import jakarta.persistence.EntityManager;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.AfterClass;
@@ -349,4 +349,4 @@ private static void assertDTDFileContentDependent(String filename) {
" USER_ID CDATA #IMPLIED\n" +
">");
}
-}
\ No newline at end of file
+}
diff --git a/rider-cdi/src/test/java/com/github/database/rider/cdi/LeakHunterCDIIt.java b/rider-cdi/src/test/java/com/github/database/rider/cdi/LeakHunterCDIIt.java
index 1d76d5c4..8a999aa1 100644
--- a/rider-cdi/src/test/java/com/github/database/rider/cdi/LeakHunterCDIIt.java
+++ b/rider-cdi/src/test/java/com/github/database/rider/cdi/LeakHunterCDIIt.java
@@ -12,8 +12,8 @@
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
-import javax.inject.Inject;
-import javax.persistence.EntityManager;
+import jakarta.inject.Inject;
+import jakarta.persistence.EntityManager;
import java.sql.*;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/rider-cdi/src/test/java/com/github/database/rider/cdi/MergeDataSetsCDIIt.java b/rider-cdi/src/test/java/com/github/database/rider/cdi/MergeDataSetsCDIIt.java
index 65a0a628..00e44c85 100644
--- a/rider-cdi/src/test/java/com/github/database/rider/cdi/MergeDataSetsCDIIt.java
+++ b/rider-cdi/src/test/java/com/github/database/rider/cdi/MergeDataSetsCDIIt.java
@@ -4,8 +4,8 @@
import java.util.List;
-import javax.inject.Inject;
-import javax.persistence.EntityManager;
+import jakarta.inject.Inject;
+import jakarta.persistence.EntityManager;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.After;
diff --git a/rider-cdi/src/test/java/com/github/database/rider/cdi/MergeDataSetsClassLevelFirstCDIIt.java b/rider-cdi/src/test/java/com/github/database/rider/cdi/MergeDataSetsClassLevelFirstCDIIt.java
index 9d5ef48c..74819ceb 100644
--- a/rider-cdi/src/test/java/com/github/database/rider/cdi/MergeDataSetsClassLevelFirstCDIIt.java
+++ b/rider-cdi/src/test/java/com/github/database/rider/cdi/MergeDataSetsClassLevelFirstCDIIt.java
@@ -12,8 +12,8 @@
import org.junit.Test;
import org.junit.runner.RunWith;
-import javax.inject.Inject;
-import javax.persistence.EntityManager;
+import jakarta.inject.Inject;
+import jakarta.persistence.EntityManager;
import java.util.List;
import static com.github.database.rider.core.util.EntityManagerProvider.em;
diff --git a/rider-cdi/src/test/java/com/github/database/rider/cdi/MergeDataSetsMethodLevelFirstCDIIt.java b/rider-cdi/src/test/java/com/github/database/rider/cdi/MergeDataSetsMethodLevelFirstCDIIt.java
index 5993ac7b..27a8f4ba 100644
--- a/rider-cdi/src/test/java/com/github/database/rider/cdi/MergeDataSetsMethodLevelFirstCDIIt.java
+++ b/rider-cdi/src/test/java/com/github/database/rider/cdi/MergeDataSetsMethodLevelFirstCDIIt.java
@@ -9,8 +9,8 @@
import org.junit.Test;
import org.junit.runner.RunWith;
-import javax.inject.Inject;
-import javax.persistence.EntityManager;
+import jakarta.inject.Inject;
+import jakarta.persistence.EntityManager;
import java.util.List;
import static com.github.database.rider.core.util.EntityManagerProvider.em;
diff --git a/rider-cdi/src/test/java/com/github/database/rider/cdi/MetaDataSetIt.java b/rider-cdi/src/test/java/com/github/database/rider/cdi/MetaDataSetIt.java
index 2c36884d..b6bb032d 100644
--- a/rider-cdi/src/test/java/com/github/database/rider/cdi/MetaDataSetIt.java
+++ b/rider-cdi/src/test/java/com/github/database/rider/cdi/MetaDataSetIt.java
@@ -3,8 +3,8 @@
import static org.assertj.core.api.Assertions.assertThat;
import java.util.List;
-import javax.inject.Inject;
-import javax.persistence.EntityManager;
+import jakarta.inject.Inject;
+import jakarta.persistence.EntityManager;
import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/rider-cdi/src/test/java/com/github/database/rider/cdi/MultipleEntityManagerIt.java b/rider-cdi/src/test/java/com/github/database/rider/cdi/MultipleEntityManagerIt.java
index a7e19827..ceea706b 100644
--- a/rider-cdi/src/test/java/com/github/database/rider/cdi/MultipleEntityManagerIt.java
+++ b/rider-cdi/src/test/java/com/github/database/rider/cdi/MultipleEntityManagerIt.java
@@ -12,8 +12,8 @@
import org.junit.Test;
import org.junit.runner.RunWith;
-import javax.inject.Inject;
-import javax.persistence.EntityManager;
+import jakarta.inject.Inject;
+import jakarta.persistence.EntityManager;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
@@ -208,4 +208,4 @@ public IDataSet provide() throws DataSetException {
return builder.build();
}
}
-}
\ No newline at end of file
+}
diff --git a/rider-cdi/src/test/java/com/github/database/rider/cdi/RiderCDILifecycleHooksIt.java b/rider-cdi/src/test/java/com/github/database/rider/cdi/RiderCDILifecycleHooksIt.java
index 0ac410dd..da807835 100644
--- a/rider-cdi/src/test/java/com/github/database/rider/cdi/RiderCDILifecycleHooksIt.java
+++ b/rider-cdi/src/test/java/com/github/database/rider/cdi/RiderCDILifecycleHooksIt.java
@@ -11,8 +11,8 @@
import org.junit.Test;
import org.junit.runner.RunWith;
-import javax.inject.Inject;
-import javax.persistence.EntityManager;
+import jakarta.inject.Inject;
+import jakarta.persistence.EntityManager;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/rider-cdi/src/test/java/com/github/database/rider/cdi/TransactionCDIIt.java b/rider-cdi/src/test/java/com/github/database/rider/cdi/TransactionCDIIt.java
index fa6d0da0..55174e32 100644
--- a/rider-cdi/src/test/java/com/github/database/rider/cdi/TransactionCDIIt.java
+++ b/rider-cdi/src/test/java/com/github/database/rider/cdi/TransactionCDIIt.java
@@ -8,8 +8,8 @@
import org.junit.Test;
import org.junit.runner.RunWith;
-import javax.inject.Inject;
-import javax.persistence.EntityManager;
+import jakarta.inject.Inject;
+import jakarta.persistence.EntityManager;
/**
diff --git a/rider-cdi/src/test/java/com/github/database/rider/cdi/infra/EntityManagerProducer.java b/rider-cdi/src/test/java/com/github/database/rider/cdi/infra/EntityManagerProducer.java
index 1c434d85..bd089fa1 100644
--- a/rider-cdi/src/test/java/com/github/database/rider/cdi/infra/EntityManagerProducer.java
+++ b/rider-cdi/src/test/java/com/github/database/rider/cdi/infra/EntityManagerProducer.java
@@ -4,9 +4,9 @@
import com.github.database.rider.cdi.api.RiderPU;
import com.github.database.rider.core.util.EntityManagerProvider;
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.inject.Produces;
-import javax.persistence.EntityManager;
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.enterprise.inject.Produces;
+import jakarta.persistence.EntityManager;
/**
* Created by pestano on 09/10/15.
diff --git a/rider-cdi/src/test/java/com/github/database/rider/cdi/model/Follower.java b/rider-cdi/src/test/java/com/github/database/rider/cdi/model/Follower.java
index 02d30209..9347de06 100644
--- a/rider-cdi/src/test/java/com/github/database/rider/cdi/model/Follower.java
+++ b/rider-cdi/src/test/java/com/github/database/rider/cdi/model/Follower.java
@@ -1,6 +1,6 @@
package com.github.database.rider.cdi.model;
-import javax.persistence.*;
+import jakarta.persistence.*;
/**
* Created by pestano on 22/07/15.
diff --git a/rider-cdi/src/test/java/com/github/database/rider/cdi/model/Tweet.java b/rider-cdi/src/test/java/com/github/database/rider/cdi/model/Tweet.java
index 9abc40df..ca88aac2 100644
--- a/rider-cdi/src/test/java/com/github/database/rider/cdi/model/Tweet.java
+++ b/rider-cdi/src/test/java/com/github/database/rider/cdi/model/Tweet.java
@@ -1,7 +1,7 @@
package com.github.database.rider.cdi.model;
-import javax.persistence.*;
-import javax.validation.constraints.Size;
+import jakarta.persistence.*;
+import jakarta.validation.constraints.Size;
import java.util.Date;
/**
diff --git a/rider-cdi/src/test/java/com/github/database/rider/cdi/model/User.java b/rider-cdi/src/test/java/com/github/database/rider/cdi/model/User.java
index 5293df3d..41a61cf6 100644
--- a/rider-cdi/src/test/java/com/github/database/rider/cdi/model/User.java
+++ b/rider-cdi/src/test/java/com/github/database/rider/cdi/model/User.java
@@ -1,9 +1,9 @@
package com.github.database.rider.cdi.model;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.OneToMany;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.Id;
+import jakarta.persistence.OneToMany;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
diff --git a/rider-cdi/src/test/java/com/github/database/rider/cdi/model/User_.java b/rider-cdi/src/test/java/com/github/database/rider/cdi/model/User_.java
index f6820abc..459cd566 100644
--- a/rider-cdi/src/test/java/com/github/database/rider/cdi/model/User_.java
+++ b/rider-cdi/src/test/java/com/github/database/rider/cdi/model/User_.java
@@ -1,8 +1,8 @@
package com.github.database.rider.cdi.model;
-import javax.annotation.Generated;
-import javax.persistence.metamodel.SingularAttribute;
-import javax.persistence.metamodel.StaticMetamodel;
+import jakarta.annotation.Generated;
+import jakarta.persistence.metamodel.SingularAttribute;
+import jakarta.persistence.metamodel.StaticMetamodel;
@Generated(value = "org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor")
@StaticMetamodel(User.class)
@@ -12,4 +12,3 @@ public abstract class User_ {
public static volatile SingularAttribute id;
}
-
diff --git a/rider-cdi/src/test/resources/META-INF/persistence.xml b/rider-cdi/src/test/resources/META-INF/persistence.xml
index 285f9ea2..b9cc82e4 100644
--- a/rider-cdi/src/test/resources/META-INF/persistence.xml
+++ b/rider-cdi/src/test/resources/META-INF/persistence.xml
@@ -10,11 +10,11 @@
com.github.database.rider.cdi.model.Follower
-
-
-
-
-
+
+
+
+
+
@@ -29,11 +29,11 @@
com.github.database.rider.cdi.model.Follower
-
-
-
-
-
+
+
+
+
+
@@ -41,4 +41,4 @@
-
\ No newline at end of file
+
diff --git a/rider-core/pom.xml b/rider-core/pom.xml
index e6fb23a1..f0e63d02 100644
--- a/rider-core/pom.xml
+++ b/rider-core/pom.xml
@@ -50,13 +50,13 @@
org.hibernate
hibernate-core
- 4.3.5.Final
+ ${hibernate.javax.version}
provided
org.eclipse.persistence
eclipselink
- 2.5.2
+ ${eclipselink.javax.version}
provided
@@ -91,7 +91,7 @@
org.mockito
mockito-core
- 3.10.0
+ ${mockito.version}
test
@@ -105,14 +105,14 @@
com.h2database
h2
- 2.1.212
+ ${h2.version}
test
org.flywaydb
flyway-core
- 3.2.1
+ ${flyway.version}
test
@@ -128,7 +128,7 @@
org.postgresql
postgresql
- 42.2.5
+ ${postgresql.version}
test
@@ -143,7 +143,7 @@
com.microsoft.sqlserver
mssql-jdbc
- 7.4.1.jre8
+ ${mssql-jdbc.version}
test
@@ -163,7 +163,7 @@
com.mysql
mysql-connector-j
- 8.0.31
+ ${mysql.version}
test
@@ -213,13 +213,13 @@
org.hibernate
hibernate-core
- 6.2.3.Final
+ ${hibernate.jakarta.version}
provided
org.eclipse.persistence
eclipselink
- 4.0.1
+ ${eclipselink.jakarta.version}
provided
diff --git a/rider-core/src/main/java/com/github/database/rider/core/dataset/builder/BuilderUtil.java b/rider-core/src/main/java/com/github/database/rider/core/dataset/builder/BuilderUtil.java
index 21f88bf6..2d5fc5ac 100644
--- a/rider-core/src/main/java/com/github/database/rider/core/dataset/builder/BuilderUtil.java
+++ b/rider-core/src/main/java/com/github/database/rider/core/dataset/builder/BuilderUtil.java
@@ -5,12 +5,11 @@
import org.dbunit.dataset.Column;
import org.dbunit.dataset.datatype.DataType;
import org.eclipse.persistence.internal.jpa.metamodel.AttributeImpl;
-import org.hibernate.SessionFactory;
-import org.hibernate.persister.entity.AbstractEntityPersister;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.persistence.metamodel.Attribute;
+import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.util.Date;
@@ -44,8 +43,7 @@ public static String getColumnNameFromMetaModel(Attribute column) {
if (isEclipseLinkOnClasspath()) {
columnName = ((AttributeImpl) column).getMapping().getField().getName();
} else if (isHibernateOnClasspath() && isEntityManagerActive()) {
- AbstractEntityPersister entityMetadata = (AbstractEntityPersister) em().getEntityManagerFactory().unwrap(SessionFactory.class).getClassMetadata(column.getJavaMember().getDeclaringClass());
- columnName = entityMetadata.getPropertyColumnNames(column.getName())[0];
+ columnName = getHibernateColumnName(column);
}
} catch (Exception e) {
LOGGER.error("Could not extract database column name from column {} and type {}", column.getName(), column.getDeclaringType().getJavaType().getName(), e);
@@ -64,6 +62,27 @@ public static boolean isEclipseLinkOnClasspath() {
return isOnClasspath("org.eclipse.persistence.mappings.DirectToFieldMapping");
}
+ private static String getHibernateColumnName(Attribute column) throws Exception {
+ Object sessionFactory = em().getEntityManagerFactory().unwrap(Class.forName("org.hibernate.SessionFactory"));
+ Object entityMetadata;
+
+ try {
+ Method getClassMetadata = sessionFactory.getClass().getMethod("getClassMetadata", Class.class);
+ entityMetadata = getClassMetadata.invoke(sessionFactory, column.getJavaMember().getDeclaringClass());
+ } catch (NoSuchMethodException ignored) {
+ Object runtimeMetamodels = sessionFactory.getClass().getMethod("getRuntimeMetamodels").invoke(sessionFactory);
+ Object mappingMetamodel = runtimeMetamodels.getClass().getMethod("getMappingMetamodel").invoke(runtimeMetamodels);
+ entityMetadata = mappingMetamodel.getClass()
+ .getMethod("getEntityDescriptor", Class.class)
+ .invoke(mappingMetamodel, column.getJavaMember().getDeclaringClass());
+ }
+
+ String[] columnNames = (String[]) entityMetadata.getClass()
+ .getMethod("getPropertyColumnNames", String.class)
+ .invoke(entityMetadata, column.getName());
+ return columnNames[0];
+ }
+
/**
* @param value column value
* @return resolved datatype
diff --git a/rider-core/src/main/java/com/github/database/rider/core/util/EntityManagerProvider.java b/rider-core/src/main/java/com/github/database/rider/core/util/EntityManagerProvider.java
index ed691a0d..52e41e22 100644
--- a/rider-core/src/main/java/com/github/database/rider/core/util/EntityManagerProvider.java
+++ b/rider-core/src/main/java/com/github/database/rider/core/util/EntityManagerProvider.java
@@ -1,7 +1,6 @@
package com.github.database.rider.core.util;
import org.hibernate.Session;
-import org.hibernate.internal.SessionImpl;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
@@ -121,7 +120,7 @@ private Connection createConnection(EntityManager em) {
Connection connection;
final EntityTransaction tx = em.getTransaction();
if (isHibernateOnClasspath() && em.getDelegate() instanceof Session) {
- connection = ((SessionImpl) em.unwrap(Session.class)).connection();
+ connection = em.unwrap(Session.class).doReturningWork(returningConnection -> returningConnection);
} else {
/**
* see here:http://wiki.eclipse.org/EclipseLink/Examples/JPA/EMAPI#Getting_a_JDBC_Connection_from_an_EntityManager
@@ -270,4 +269,4 @@ private static void checkInstance() {
public static boolean isEntityManagerActive() {
return instance != null && em().isOpen();
}
-}
\ No newline at end of file
+}
diff --git a/rider-core/src/main/java/com/github/database/rider/core/util/EntityManagerProvider.jv b/rider-core/src/main/java/com/github/database/rider/core/util/EntityManagerProvider.jv
index 9ec7346d..e0ed8ab1 100644
--- a/rider-core/src/main/java/com/github/database/rider/core/util/EntityManagerProvider.jv
+++ b/rider-core/src/main/java/com/github/database/rider/core/util/EntityManagerProvider.jv
@@ -1,7 +1,6 @@
package com.github.database.rider.core.util;
import org.hibernate.Session;
-import org.hibernate.internal.SessionImpl;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
@@ -121,9 +120,7 @@ public class EntityManagerProvider implements TestRule {
Connection connection;
final EntityTransaction tx = em.getTransaction();
if (isHibernateOnClasspath() && em.getDelegate() instanceof Session) {
- connection = em.unwrap(org.hibernate.engine.spi.SessionImplementor.class).getJdbcCoordinator()
- .getLogicalConnection()
- .getPhysicalConnection();
+ connection = em.unwrap(Session.class).doReturningWork(returningConnection -> returningConnection);
} else {
/**
* see here:http://wiki.eclipse.org/EclipseLink/Examples/JPA/EMAPI#Getting_a_JDBC_Connection_from_an_EntityManager
@@ -272,4 +269,4 @@ public class EntityManagerProvider implements TestRule {
public static boolean isEntityManagerActive() {
return instance != null && em().isOpen();
}
-}
\ No newline at end of file
+}
diff --git a/rider-core/src/test/java/com/github/database/rider/core/NoPKIt.java b/rider-core/src/test/java/com/github/database/rider/core/NoPKIt.java
index 2306a73d..5e253e0e 100644
--- a/rider-core/src/test/java/com/github/database/rider/core/NoPKIt.java
+++ b/rider-core/src/test/java/com/github/database/rider/core/NoPKIt.java
@@ -36,11 +36,12 @@ public NoPKIt() throws SQLException {
@BeforeClass
public static void initMigration() throws SQLException {
- flyway = new Flyway();
- flyway.setDataSource(DB_URL, "sa", "");
- flyway.setLocations("filesystem:src/test/resources/migration");
+ flyway = Flyway.configure()
+ .dataSource(DB_URL, "sa", "")
+ .locations("filesystem:src/test/resources/migration")
+ .load();
flyway.migrate();
- connection = flyway.getDataSource().getConnection();
+ connection = flyway.getConfiguration().getDataSource().getConnection();
}
@AfterClass
diff --git a/rider-examples/jOOQ-DBUnit-flyway-example/pom.xml.releaseBackup b/rider-examples/jOOQ-DBUnit-flyway-example/pom.xml.releaseBackup
deleted file mode 100644
index 1885e149..00000000
--- a/rider-examples/jOOQ-DBUnit-flyway-example/pom.xml.releaseBackup
+++ /dev/null
@@ -1,164 +0,0 @@
-
-
- 4.0.0
-
-
- com.github.database-rider
- rider-examples
- 1.13.2-SNAPSHOT
-
-
- jooq-dbunit-flyway-example
- jOOQ DBUnit Flyway Example
-
-
- UTF-8
- 3.2.6.RELEASE
- 3.8.4
- 1.4.192
- jdbc:h2:${project.build.directory}/flyway-test
- sa
-
-
-
-
-
-
- org.jooq
- jooq
- ${org.jooq.version}
-
-
- com.h2database
- h2
- ${org.h2.version}
-
-
-
-
- log4j
- log4j
- 1.2.16
-
-
- org.slf4j
- slf4j-log4j12
- 1.7.5
-
-
-
- org.flywaydb
- flyway-core
- 3.2.1
- test
-
-
-
-
- junit
- junit
- 4.12
- test
-
-
-
- com.github.database-rider
- rider-core
- ${project.parent.version}
- test
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.3
-
- true
- 1024m
- 256m
- UTF-8
- 1.8
- 1.8
- true
- lines,vars,source
-
-
-
-
- org.flywaydb
- flyway-maven-plugin
- 3.2.1
-
-
- generate-sources
-
- migrate
-
-
-
-
- ${db.url}
- ${db.username}
-
- filesystem:src/main/resources/db/migration
-
-
-
-
-
- org.jooq
- jooq-codegen-maven
- ${org.jooq.version}
-
-
-
- generate-sources
-
- generate
-
-
-
-
-
-
- jakarta.xml.bind
- jakarta.xml.bind-api
- 2.3.2
-
-
-
- com.sun.xml.bind
- jaxb-impl
- 2.1.2
-
-
-
-
-
- ${db.url}
- ${db.username}
-
-
-
- .*
- FLYWAY_TEST
- SELECT 'DEFAULT_CATALOG_' || TO_CHAR(current_timestamp,
- 'YYYYMMDDHHMISS')
-
- SELECT :schema_name || '_' || MAX("version") FROM "schema_version"
-
-
-
- org.jooq.example.flyway.db.h2
- target/generated-sources/jooq-h2
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/rider-examples/jOOQ-DBUnit-flyway-example/src/test/java/JooqDBUnitTest.java b/rider-examples/jOOQ-DBUnit-flyway-example/src/test/java/JooqDBUnitTest.java
index 2e17f290..e16a0f30 100644
--- a/rider-examples/jOOQ-DBUnit-flyway-example/src/test/java/JooqDBUnitTest.java
+++ b/rider-examples/jOOQ-DBUnit-flyway-example/src/test/java/JooqDBUnitTest.java
@@ -33,17 +33,18 @@ public class JooqDBUnitTest {
@Rule
public DBUnitRule dbUnitRule = DBUnitRule.
- instance(() -> flyway.getDataSource().getConnection());
+ instance(() -> flyway.getConfiguration().getDataSource().getConnection());
@BeforeClass
public static void initMigration() throws SQLException {
- flyway = new Flyway();
- flyway.setDataSource(DB_URL, "sa", "");
- flyway.setLocations("filesystem:src/main/resources/db/migration");
+ flyway = Flyway.configure()
+ .dataSource(DB_URL, "sa", "")
+ .locations("filesystem:src/main/resources/db/migration")
+ .load();
flyway.migrate();
- connection = flyway.getDataSource().getConnection();
+ connection = flyway.getConfiguration().getDataSource().getConnection();
//add some data to test db cleanup
try (Statement stmt = connection.createStatement()) {
stmt.addBatch("INSERT INTO flyway_test.author(id, first_name, last_name, date_of_birth, year_of_birth, address) VALUES (1, 'Erich', 'Gamma','1903-06-25','1900',null)");
diff --git a/rider-examples/jpa-productivity-boosters/pom.xml b/rider-examples/jpa-productivity-boosters/pom.xml
index 547312ce..49494709 100644
--- a/rider-examples/jpa-productivity-boosters/pom.xml
+++ b/rider-examples/jpa-productivity-boosters/pom.xml
@@ -224,4 +224,13 @@
+
+
+ jakarta
+
+ true
+
+
+
+
diff --git a/rider-examples/jpa-productivity-boosters/pom.xml.releaseBackup b/rider-examples/jpa-productivity-boosters/pom.xml.releaseBackup
deleted file mode 100644
index 62a23b2d..00000000
--- a/rider-examples/jpa-productivity-boosters/pom.xml.releaseBackup
+++ /dev/null
@@ -1,219 +0,0 @@
-
-
- 4.0.0
-
- com.github.database-rider
- rider-examples
- 1.13.2-SNAPSHOT
-
-
- jpa-productivity-boosters
- jar
-
-
-
- org.apache.deltaspike.modules
- deltaspike-data-module-api
- ${ds.version}
- compile
-
-
- org.apache.deltaspike.modules
- deltaspike-data-module-impl
- ${ds.version}
- runtime
-
-
-
- org.apache.deltaspike.modules
- deltaspike-jpa-module-api
- ${ds.version}
- compile
-
-
- org.apache.deltaspike.modules
- deltaspike-jpa-module-impl
- ${ds.version}
- runtime
-
-
-
- org.springframework.data
- spring-data-jpa
- 1.7.2.RELEASE
-
-
-
- com.mysema.querydsl
- querydsl-core
- 3.6.2
-
-
- com.mysema.querydsl
- querydsl-jpa
- 3.6.2
-
-
-
-
-
- com.github.database-rider
- rider-core
- ${project.parent.version}
- test
-
-
-
-
- com.github.database-rider
- rider-cdi
- ${project.parent.version}
- test
-
-
-
- com.github.database-rider
- rider-cucumber
- ${project.parent.version}
- test
-
-
-
- org.apache.deltaspike.modules
- deltaspike-test-control-module-api
- ${ds.version}
- test
-
-
-
- org.apache.deltaspike.core
- deltaspike-core-impl
- ${ds.version}
- test
-
-
-
- org.apache.deltaspike.modules
- deltaspike-test-control-module-impl
- ${ds.version}
- test
-
-
- org.apache.deltaspike.cdictrl
- deltaspike-cdictrl-weld
- ${ds.version}
- test
-
-
-
- org.jboss.weld.se
- weld-se-core
- 2.2.14.Final
- test
-
-
- guava
- com.google.guava
-
-
-
-
-
- org.hibernate
- hibernate-core
- 4.2.8.Final
- provided
-
-
- org.hibernate
- hibernate-entitymanager
- 4.2.8.Final
- test
-
-
- org.jboss.spec
- jboss-javaee-6.0
- 3.0.3.Final
- pom
-
-
-
-
- javax.validation
- validation-api
- 1.1.0.Final
- test
-
-
-
- org.jboss
- jandex
- 1.2.2.Final
- test
-
-
-
-
-
-
-
- com.mysema.maven
- apt-maven-plugin
- 1.1.3
-
-
- querydsl
-
- process
-
-
- target/generated-sources/querydsl
- com.mysema.query.apt.jpa.JPAAnnotationProcessor
-
-
-
- metamodel
-
- process
-
-
- target/generated-sources/metamodel
- org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor
-
-
-
-
-
- org.hibernate
- hibernate-jpamodelgen
- 4.3.8.Final
-
-
- com.mysema.querydsl
- querydsl-apt
- 3.6.1
-
-
-
-
-
- maven-surefire-plugin
- 2.19.1
-
-
- **/Test*.java
- **/*It.java
- **/*Test.java
-
-
-
- error
-
-
-
-
-
-
-
-
-
diff --git a/rider-examples/pom.xml b/rider-examples/pom.xml
index cf63e400..cd8bc321 100644
--- a/rider-examples/pom.xml
+++ b/rider-examples/pom.xml
@@ -11,24 +11,12 @@
rider-examples
pom
-
- jpa-productivity-boosters
- jOOQ-DBUnit-flyway-example
- dbunit-tomee-appcomposer-sample
- spring-boot-dbunit-sample
- quarkus-dbunit-sample
- quarkus-postgres-sample
- rider-micronaut
- rider-kotlin
-
-
Database Rider examples
maven-javadoc-plugin
- 3.4.0
attach-javadocs
@@ -38,13 +26,12 @@
- 8
+ ${maven.compiler.release}
org.apache.maven.plugins
maven-deploy-plugin
- 2.7
true
@@ -52,4 +39,30 @@
+
+
+ legacy-examples
+
+ true
+
+
+ jpa-productivity-boosters
+ jOOQ-DBUnit-flyway-example
+ dbunit-tomee-appcomposer-sample
+ spring-boot-dbunit-sample
+ quarkus-dbunit-sample
+ quarkus-postgres-sample
+ rider-micronaut
+ rider-kotlin
+
+
+
+ jakarta
+
+ spring-boot-dbunit-sample
+ rider-kotlin
+
+
+
+
diff --git a/rider-examples/quarkus-dbunit-sample/pom.xml b/rider-examples/quarkus-dbunit-sample/pom.xml
index a2b73bc7..c040b3c8 100644
--- a/rider-examples/quarkus-dbunit-sample/pom.xml
+++ b/rider-examples/quarkus-dbunit-sample/pom.xml
@@ -11,15 +11,12 @@
rider-quarkus-sample
- 3.8.1
true
- 11
- 11
UTF-8
UTF-8
quarkus-bom
io.quarkus.platform
- 3.0.4.Final
+ ${quarkus.version}
@@ -62,7 +59,7 @@
com.github.database-rider
rider-cdi
- 1.38.1
+ ${project.version}
test
jakarta
@@ -78,12 +75,6 @@
3.24.2
test
-
- javax.servlet
- javax.servlet-api
- 3.1.0
- test
-
@@ -104,11 +95,9 @@
maven-compiler-plugin
- ${compiler-plugin.version}
${maven.compiler.parameters}
- 11
- 11
+ ${maven.compiler.release}
@@ -133,7 +122,7 @@
- 8
+ ${maven.compiler.release}
@@ -146,4 +135,4 @@
-
\ No newline at end of file
+
diff --git a/rider-examples/rider-kotlin/README.md b/rider-examples/rider-kotlin/README.md
index 55736979..8246f04d 100644
--- a/rider-examples/rider-kotlin/README.md
+++ b/rider-examples/rider-kotlin/README.md
@@ -1 +1,7 @@
# DBRider SpringBoot kotlin example
+
+This sample now targets Java 17, Kotlin 2.3.x, Spring Boot 3.5.x, and Jakarta Persistence.
+
+Build it with the Database Rider Jakarta classifier enabled:
+
+`mvn -Pjakarta -pl rider-examples/rider-kotlin -am test`
diff --git a/rider-examples/rider-kotlin/pom.xml b/rider-examples/rider-kotlin/pom.xml
index 0703caa4..fdaa046a 100644
--- a/rider-examples/rider-kotlin/pom.xml
+++ b/rider-examples/rider-kotlin/pom.xml
@@ -13,16 +13,15 @@
- 11
+ 17
UTF-8
yyyyMMddHHmmssSSS
- 11
+ 17
true
- 11
+ 17
- 1.7.0
- 2.7.1
+ ${spring.boot.version}
@@ -52,7 +51,7 @@
com.h2database
h2
- 2.1.214
+ ${h2.version}
runtime
@@ -73,6 +72,7 @@
com.github.database-rider
rider-junit5
${project.parent.version}
+ jakarta
test
diff --git a/rider-examples/rider-kotlin/src/main/kotlin/com/github/trks1970/EmailEntity.kt b/rider-examples/rider-kotlin/src/main/kotlin/com/github/trks1970/EmailEntity.kt
index e5b77e65..7d00a8a4 100644
--- a/rider-examples/rider-kotlin/src/main/kotlin/com/github/trks1970/EmailEntity.kt
+++ b/rider-examples/rider-kotlin/src/main/kotlin/com/github/trks1970/EmailEntity.kt
@@ -1,8 +1,8 @@
package com.github.trks1970
-import javax.persistence.Column
-import javax.persistence.Entity
-import javax.persistence.Id
+import jakarta.persistence.Column
+import jakarta.persistence.Entity
+import jakarta.persistence.Id
@Entity
class EmailEntity (
@@ -11,4 +11,4 @@ class EmailEntity (
@Column(nullable = false, unique = true)
var mail: String? = null
-){}
\ No newline at end of file
+){}
diff --git a/rider-examples/rider-kotlin/src/test/kotlin/com/github/trks1970/H2JPAConfig.kt b/rider-examples/rider-kotlin/src/test/kotlin/com/github/trks1970/H2JPAConfig.kt
index 084a8cc4..11f51b21 100644
--- a/rider-examples/rider-kotlin/src/test/kotlin/com/github/trks1970/H2JPAConfig.kt
+++ b/rider-examples/rider-kotlin/src/test/kotlin/com/github/trks1970/H2JPAConfig.kt
@@ -1,8 +1,10 @@
package com.github.trks1970
+import jakarta.persistence.EntityManagerFactory
import org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy
import org.hibernate.cfg.AvailableSettings
import org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
import org.springframework.data.jpa.repository.config.EnableJpaRepositories
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType
@@ -12,9 +14,9 @@ import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter
import org.springframework.transaction.PlatformTransactionManager
import org.springframework.transaction.annotation.EnableTransactionManagement
import java.util.Properties
-import javax.persistence.EntityManagerFactory
import javax.sql.DataSource
+@Configuration
@EnableJpaRepositories
@EnableTransactionManagement
class H2JPAConfig {
@@ -50,7 +52,7 @@ class H2JPAConfig {
private fun hibernateProperties(): Properties {
val properties = Properties()
properties[AvailableSettings.DIALECT] = org.hibernate.dialect.H2Dialect::class.qualifiedName
- properties["javax.persistence.schema-generation.database.action"] = "drop-and-create"
+ properties["jakarta.persistence.schema-generation.database.action"] = "drop-and-create"
properties[AvailableSettings.PHYSICAL_NAMING_STRATEGY] = CamelCaseToUnderscoresNamingStrategy::class.qualifiedName
properties[AvailableSettings.IMPLICIT_NAMING_STRATEGY] = SpringImplicitNamingStrategy::class.qualifiedName
return properties
diff --git a/rider-examples/spring-boot-dbunit-sample/README.adoc b/rider-examples/spring-boot-dbunit-sample/README.adoc
index 1dfa349b..1a80f769 100644
--- a/rider-examples/spring-boot-dbunit-sample/README.adoc
+++ b/rider-examples/spring-boot-dbunit-sample/README.adoc
@@ -7,3 +7,11 @@
A simple SpringBoot (with JPA and Data modules) example application using Database Rider for testing JPA repositories.
+This sample now targets Java 17, Spring Boot 3.5.x, Spring Framework 6.x, and Jakarta namespaces.
+
+Build it with the Jakarta profile so the `rider-junit5` Jakarta classifier is produced:
+
+`mvn -Pjakarta -pl rider-examples/spring-boot-dbunit-sample -am test`
+
+The primary Boot 3 regression coverage in this module is `MultipleDataSourcesTest` plus the leak-hunter path.
+*** Delete File: /Users/sagemaasch/Documents/database-rider/rider-examples/rider-kotlin/src/test/resources/datasets/test_data.yaml
diff --git a/rider-examples/spring-boot-dbunit-sample/pom.xml b/rider-examples/spring-boot-dbunit-sample/pom.xml
index b56c9807..7a5a1487 100644
--- a/rider-examples/spring-boot-dbunit-sample/pom.xml
+++ b/rider-examples/spring-boot-dbunit-sample/pom.xml
@@ -14,8 +14,8 @@
UTF-8
com.github.database.rider.springboot.Application
- 2.5.4
- 1.8
+ ${spring.boot.version}
+ 17
@@ -23,6 +23,7 @@
com.github.database-rider
rider-junit5
${project.version}
+ jakarta
test
@@ -33,10 +34,14 @@
org.springframework.boot
spring-boot-starter-data-jpa
+
+ org.springframework.boot
+ spring-boot-starter-validation
+
org.hsqldb
hsqldb
- 2.6.1
+ ${hsqldb.version}
runtime
@@ -76,10 +81,8 @@
org.apache.maven.plugins
maven-compiler-plugin
- 3.8.1
- 1.8
- 1.8
+ ${java.version}
UTF-8
@@ -96,7 +99,6 @@
org.apache.maven.plugins
maven-deploy-plugin
- 2.7
true
diff --git a/rider-examples/spring-boot-dbunit-sample/pom.xml.releaseBackup b/rider-examples/spring-boot-dbunit-sample/pom.xml.releaseBackup
deleted file mode 100644
index 3801d52e..00000000
--- a/rider-examples/spring-boot-dbunit-sample/pom.xml.releaseBackup
+++ /dev/null
@@ -1,119 +0,0 @@
-
-
- 4.0.0
-
- springboot-dbunit-sample
- spring-boot-dbunit-sample
- Use Spring Data JPA + Hibernate + H2 + Database Rider for testing a Spring Boot application
-
- com.github.database-rider
- rider-examples
- 1.13.2-SNAPSHOT
-
-
-
-
- com.github.database-rider
- rider-junit5
- ${project.version}
- test
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
- org.springframework.boot
- spring-boot-starter-data-jpa
-
-
- org.hsqldb
- hsqldb
- 2.3.3
- runtime
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
- junit
- junit
-
-
-
-
- org.junit.jupiter
- junit-jupiter-engine
- test
-
-
- org.junit.jupiter
- junit-jupiter
- test
-
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-starter-parent
- 2.2.0.RELEASE
- pom
- import
-
-
-
-
-
- UTF-8
- com.github.database.rider.springboot.Application
- 1.8
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 2.5.1
-
- 1.8
- 1.8
- UTF-8
-
-
-
- maven-javadoc-plugin
- 3.1.1
-
-
- attach-javadocs
-
- jar
-
-
-
-
- 8
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
- 1.4.0.RELEASE
-
-
- maven-war-plugin
-
- false
-
-
-
-
-
-
-
diff --git a/rider-examples/spring-boot-dbunit-sample/src/main/java/com/github/database/rider/springboot/infra/company/CompanyDBConfig.java b/rider-examples/spring-boot-dbunit-sample/src/main/java/com/github/database/rider/springboot/infra/company/CompanyDBConfig.java
index 506366fc..3018d44e 100644
--- a/rider-examples/spring-boot-dbunit-sample/src/main/java/com/github/database/rider/springboot/infra/company/CompanyDBConfig.java
+++ b/rider-examples/spring-boot-dbunit-sample/src/main/java/com/github/database/rider/springboot/infra/company/CompanyDBConfig.java
@@ -17,7 +17,7 @@
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
-import javax.persistence.EntityManagerFactory;
+import jakarta.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import java.util.HashMap;
import java.util.Map;
diff --git a/rider-examples/spring-boot-dbunit-sample/src/main/java/com/github/database/rider/springboot/infra/user/UserDBConfig.java b/rider-examples/spring-boot-dbunit-sample/src/main/java/com/github/database/rider/springboot/infra/user/UserDBConfig.java
index aade54de..043fcad4 100644
--- a/rider-examples/spring-boot-dbunit-sample/src/main/java/com/github/database/rider/springboot/infra/user/UserDBConfig.java
+++ b/rider-examples/spring-boot-dbunit-sample/src/main/java/com/github/database/rider/springboot/infra/user/UserDBConfig.java
@@ -17,7 +17,7 @@
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
-import javax.persistence.EntityManagerFactory;
+import jakarta.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import java.util.HashMap;
import java.util.Map;
diff --git a/rider-examples/spring-boot-dbunit-sample/src/main/java/com/github/database/rider/springboot/model/company/Company.java b/rider-examples/spring-boot-dbunit-sample/src/main/java/com/github/database/rider/springboot/model/company/Company.java
index 5f3263b0..fe704265 100644
--- a/rider-examples/spring-boot-dbunit-sample/src/main/java/com/github/database/rider/springboot/model/company/Company.java
+++ b/rider-examples/spring-boot-dbunit-sample/src/main/java/com/github/database/rider/springboot/model/company/Company.java
@@ -1,7 +1,9 @@
package com.github.database.rider.springboot.model.company;
-import javax.persistence.*;
-import javax.validation.constraints.NotNull;
+import jakarta.persistence.*;
+import jakarta.validation.constraints.NotNull;
+
+import java.util.Objects;
@Entity
@Table(name = "company")
@@ -10,7 +12,7 @@ public class Company {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
- private long id;
+ private Long id;
@NotNull
private String name;
@@ -27,11 +29,11 @@ public Company(String name) {
this.name = name;
}
- public long getId() {
+ public Long getId() {
return id;
}
- public void setId(long value) {
+ public void setId(Long value) {
this.id = value;
}
@@ -49,13 +51,12 @@ public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) return false;
Company user = (Company) o;
-
- return id == user.id;
+ return Objects.equals(id, user.id);
}
@Override
public int hashCode() {
- return (int) (id ^ (id >>> 32));
+ return Objects.hashCode(id);
}
}
diff --git a/rider-examples/spring-boot-dbunit-sample/src/main/java/com/github/database/rider/springboot/model/company/CompanyRepository.java b/rider-examples/spring-boot-dbunit-sample/src/main/java/com/github/database/rider/springboot/model/company/CompanyRepository.java
index 8e668498..c0b94bcf 100644
--- a/rider-examples/spring-boot-dbunit-sample/src/main/java/com/github/database/rider/springboot/model/company/CompanyRepository.java
+++ b/rider-examples/spring-boot-dbunit-sample/src/main/java/com/github/database/rider/springboot/model/company/CompanyRepository.java
@@ -1,8 +1,7 @@
package com.github.database.rider.springboot.model.company;
import org.springframework.data.repository.CrudRepository;
-
-import javax.transaction.Transactional;
+import org.springframework.transaction.annotation.Transactional;
@Transactional
public interface CompanyRepository extends CrudRepository {
diff --git a/rider-examples/spring-boot-dbunit-sample/src/main/java/com/github/database/rider/springboot/model/user/User.java b/rider-examples/spring-boot-dbunit-sample/src/main/java/com/github/database/rider/springboot/model/user/User.java
index a76003d5..d7874f27 100644
--- a/rider-examples/spring-boot-dbunit-sample/src/main/java/com/github/database/rider/springboot/model/user/User.java
+++ b/rider-examples/spring-boot-dbunit-sample/src/main/java/com/github/database/rider/springboot/model/user/User.java
@@ -1,7 +1,9 @@
package com.github.database.rider.springboot.model.user;
-import javax.persistence.*;
-import javax.validation.constraints.NotNull;
+import jakarta.persistence.*;
+import jakarta.validation.constraints.NotNull;
+
+import java.util.Objects;
@Entity
@Table(name = "users")
@@ -10,7 +12,7 @@ public class User {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
- private long id;
+ private Long id;
@NotNull
private String email;
@@ -32,11 +34,11 @@ public User(String email, String name) {
}
- public long getId() {
+ public Long getId() {
return id;
}
- public void setId(long value) {
+ public void setId(Long value) {
this.id = value;
}
@@ -62,13 +64,12 @@ public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) return false;
User user = (User) o;
-
- return id == user.id;
+ return Objects.equals(id, user.id);
}
@Override
public int hashCode() {
- return (int) (id ^ (id >>> 32));
+ return Objects.hashCode(id);
}
}
diff --git a/rider-examples/spring-boot-dbunit-sample/src/main/java/com/github/database/rider/springboot/model/user/UserRepository.java b/rider-examples/spring-boot-dbunit-sample/src/main/java/com/github/database/rider/springboot/model/user/UserRepository.java
index a2dc66bc..b1cc8937 100644
--- a/rider-examples/spring-boot-dbunit-sample/src/main/java/com/github/database/rider/springboot/model/user/UserRepository.java
+++ b/rider-examples/spring-boot-dbunit-sample/src/main/java/com/github/database/rider/springboot/model/user/UserRepository.java
@@ -1,8 +1,7 @@
package com.github.database.rider.springboot.model.user;
-import javax.transaction.Transactional;
-
import org.springframework.data.repository.CrudRepository;
+import org.springframework.transaction.annotation.Transactional;
@Transactional
public interface UserRepository extends CrudRepository {
diff --git a/rider-examples/spring-boot-dbunit-sample/src/test/java/com/github/database/rider/springboot/MultipleDataSourcesTest.java b/rider-examples/spring-boot-dbunit-sample/src/test/java/com/github/database/rider/springboot/MultipleDataSourcesTest.java
index 848d4f4c..e05ce2dd 100644
--- a/rider-examples/spring-boot-dbunit-sample/src/test/java/com/github/database/rider/springboot/MultipleDataSourcesTest.java
+++ b/rider-examples/spring-boot-dbunit-sample/src/test/java/com/github/database/rider/springboot/MultipleDataSourcesTest.java
@@ -73,10 +73,12 @@ public void shouldInsertCompanies() {
}
@Test
- @DataSet(cleanBefore = true)//as we didn't declared a dataset DBUnit wont clear the table
+ @DataSet("users.yml")
@ExpectedDataSet("user.yml")
public void shouldInsertUser() {
assertThat(userRepository).isNotNull();
+ assertThat(userRepository.count()).isEqualTo(3);
+ userRepository.deleteAll();
assertThat(userRepository.count()).isEqualTo(0);
userRepository.save(new User("newUser@gmail.com", "new user"));
//assertThat(userRepository.count()).isEqualTo(1); //assertion is made by @ExpectedDataset
diff --git a/rider-examples/spring-boot-dbunit-sample/src/test/java/com/github/database/rider/springboot/SpringBootDBUnitTest.java b/rider-examples/spring-boot-dbunit-sample/src/test/java/com/github/database/rider/springboot/SpringBootDBUnitTest.java
index 91af371c..7fbd263d 100644
--- a/rider-examples/spring-boot-dbunit-sample/src/test/java/com/github/database/rider/springboot/SpringBootDBUnitTest.java
+++ b/rider-examples/spring-boot-dbunit-sample/src/test/java/com/github/database/rider/springboot/SpringBootDBUnitTest.java
@@ -2,12 +2,9 @@
import com.github.database.rider.core.api.configuration.DBUnit;
import com.github.database.rider.core.api.dataset.DataSet;
-import com.github.database.rider.core.api.dataset.ExpectedDataSet;
import com.github.database.rider.junit5.api.DBRider;
import com.github.database.rider.springboot.model.user.User;
import com.github.database.rider.springboot.model.user.UserRepository;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@@ -20,45 +17,17 @@
*/
@SpringBootTest
@DBRider
-@DBUnit(leakHunter = true)
+@DBUnit(cacheConnection = false, leakHunter = true)
public class SpringBootDBUnitTest {
@Autowired
private UserRepository userRepository;
- @BeforeAll
- @DataSet("emptyUsers.yml")
- static void beforeAll() {}
-
- @BeforeEach
- @DataSet("users.yml")
- public void setUpUsers() {
- }
-
@Test
+ @DataSet("users.yml")
public void shouldListUsers() {
assertThat(userRepository).isNotNull();
assertThat(userRepository.count()).isEqualTo(3);
assertThat(userRepository.findByEmail("springboot@gmail.com")).isEqualTo(new User(3));
}
-
- @Test
- @ExpectedDataSet("expectedUsers.yml")
- public void shouldDeleteUser() {
- assertThat(userRepository).isNotNull();
- assertThat(userRepository.count()).isEqualTo(3);
- userRepository.findById(2L).ifPresent(userRepository::delete);
- //assertThat(userRepository.count()).isEqualTo(2); //assertion is made by @ExpectedDataset
- }
-
-
- @Test
- @DataSet(cleanBefore = true)//as we didn't declared a dataset DBUnit wont clear the table
- @ExpectedDataSet("user.yml")
- public void shouldInsertUser() {
- assertThat(userRepository).isNotNull();
- assertThat(userRepository.count()).isEqualTo(0);
- userRepository.save(new User("newUser@gmail.com", "new user"));
- //assertThat(userRepository.count()).isEqualTo(1); //assertion is made by @ExpectedDataset
- }
}
diff --git a/rider-examples/spring-boot-dbunit-sample/src/test/java/com/github/database/rider/springboot/SpringBootDataJpaRollbackTest.java b/rider-examples/spring-boot-dbunit-sample/src/test/java/com/github/database/rider/springboot/SpringBootDataJpaRollbackTest.java
index 3fe8bc98..de506af8 100644
--- a/rider-examples/spring-boot-dbunit-sample/src/test/java/com/github/database/rider/springboot/SpringBootDataJpaRollbackTest.java
+++ b/rider-examples/spring-boot-dbunit-sample/src/test/java/com/github/database/rider/springboot/SpringBootDataJpaRollbackTest.java
@@ -1,19 +1,15 @@
package com.github.database.rider.springboot;
import com.github.database.rider.core.api.dataset.DataSet;
-import com.github.database.rider.core.api.dataset.ExpectedDataSet;
import com.github.database.rider.core.configuration.DataSetConfig;
import com.github.database.rider.core.configuration.ExpectedDataSetConfig;
import com.github.database.rider.junit5.api.DBRider;
-import com.github.database.rider.springboot.model.user.User;
import com.github.database.rider.springboot.model.user.UserRepository;
import org.dbunit.DatabaseUnitException;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
+import org.springframework.test.context.transaction.AfterTransaction;
import javax.sql.DataSource;
import java.sql.SQLException;
@@ -32,29 +28,19 @@ public class SpringBootDataJpaRollbackTest {
@Autowired
DataSource dataSource;
- @BeforeAll
- @DataSet("users.yml")
- static void beforeAll() {
-
- }
-
- @Disabled("Enable once we make expectedDataSet work with @DataJpaTest: https://github.com/database-rider/database-rider/issues/482")
@Test
- @DataSet(executeScriptsBefore = "/scripts/addUser.sql")
- @ExpectedDataSet(value = "expectedAllUsers.yml", ignoreCols = "id")
- public void shouldListUsers() {
+ @DataSet("users.yml")
+ public void shouldRollbackChangesMadeInsideDataJpaTestTransaction() {
assertThat(userRepository).isNotNull();
- assertThat(userRepository.count()).isEqualTo(4);
- assertThat(userRepository.findByEmail("junit5@mail.com")).isEqualTo(new User(99));
- userRepository.save(new User("bdd@cucumber.com", "cucumber"));
+ assertThat(userRepository.count()).isEqualTo(3);
+ userRepository.findById(3L).ifPresent(userRepository::delete);
+ assertThat(userRepository.count()).isEqualTo(2);
}
- /*@AfterEach
- void after() throws SQLException, DatabaseUnitException {
- userRepository.findAll()
- .forEach(System.out::println);
+ @AfterTransaction
+ void afterTransaction() throws SQLException, DatabaseUnitException {
withConnection(dataSource.getConnection())
- .withDataSetConfig(new DataSetConfig("expectedUsersAfterRollback.yml"))
- .expectDataSet(new ExpectedDataSetConfig().ignoreCols("id"));
- }*/
+ .withDataSetConfig(new DataSetConfig("users.yml"))
+ .expectDataSet(new ExpectedDataSetConfig());
+ }
}
diff --git a/rider-junit5/pom.xml b/rider-junit5/pom.xml
index 1f4ca728..c4b8e306 100644
--- a/rider-junit5/pom.xml
+++ b/rider-junit5/pom.xml
@@ -9,8 +9,6 @@
rider-junit5
- 1.7.2
- 5.7.2
src/main/java
src/test/java
@@ -24,7 +22,7 @@
org.junit.jupiter
junit-jupiter-api
- ${version.junit-jupiter}
+ ${junit.jupiter.version}
compile
@@ -34,7 +32,7 @@
org.junit.platform
junit-platform-commons
- ${version.junit-platform}
+ ${junit.platform.version}
compile
@@ -43,20 +41,20 @@
org.junit.jupiter
junit-jupiter-engine
- ${version.junit-jupiter}
+ ${junit.jupiter.version}
org.junit.jupiter
junit-jupiter-params
- ${version.junit-jupiter}
+ ${junit.jupiter.version}
test
org.junit.platform
junit-platform-runner
- ${version.junit-platform}
+ ${junit.platform.version}
test
@@ -67,25 +65,25 @@
org.hibernate
hibernate-core
- 4.3.11.Final
+ ${hibernate.javax.version}
provided
org.springframework.boot
spring-boot-test
- 2.2.0.RELEASE
+ ${spring.boot.version}
provided
org.springframework
spring-jdbc
- 5.3.21
+ ${spring.framework.version}
provided
org.springframework
spring-test
- 5.3.21
+ ${spring.framework.version}
provided
@@ -103,13 +101,13 @@
org.hibernate
hibernate-entitymanager
- 4.3.11.Final
+ ${hibernate.javax.version}
test
org.flywaydb
flyway-core
- 3.2.1
+ ${flyway.version}
test
@@ -131,13 +129,13 @@
org.hibernate
hibernate-core
- 6.2.3.Final
+ ${hibernate.jakarta.version}
provided
org.eclipse.persistence
eclipselink
- 4.0.1
+ ${eclipselink.jakarta.version}
provided
diff --git a/rider-junit5/src/main/java/com/github/database/rider/junit5/util/EntityManagerProvider.java b/rider-junit5/src/main/java/com/github/database/rider/junit5/util/EntityManagerProvider.java
index a33621bc..d80c1892 100644
--- a/rider-junit5/src/main/java/com/github/database/rider/junit5/util/EntityManagerProvider.java
+++ b/rider-junit5/src/main/java/com/github/database/rider/junit5/util/EntityManagerProvider.java
@@ -2,7 +2,6 @@
import com.github.database.rider.core.util.PropertyResolutionUtil;
import org.hibernate.Session;
-import org.hibernate.internal.SessionImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -119,7 +118,7 @@ private Connection createConnection(EntityManager em) {
Connection connection;
final EntityTransaction tx = em.getTransaction();
if (isHibernateOnClasspath() && em.getDelegate() instanceof Session) {
- connection = ((SessionImpl) em.unwrap(Session.class)).connection();
+ connection = em.unwrap(Session.class).doReturningWork(returningConnection -> returningConnection);
} else {
/**
* see here:http://wiki.eclipse.org/EclipseLink/Examples/JPA/EMAPI#Getting_a_JDBC_Connection_from_an_EntityManager
@@ -252,4 +251,4 @@ private static void checkInstance() {
public static boolean isEntityManagerActive() {
return instance != null && em().isOpen();
}
-}
\ No newline at end of file
+}
diff --git a/rider-junit5/src/main/java/com/github/database/rider/junit5/util/EntityManagerProvider.jv b/rider-junit5/src/main/java/com/github/database/rider/junit5/util/EntityManagerProvider.jv
index 8d8882b2..d80c1892 100644
--- a/rider-junit5/src/main/java/com/github/database/rider/junit5/util/EntityManagerProvider.jv
+++ b/rider-junit5/src/main/java/com/github/database/rider/junit5/util/EntityManagerProvider.jv
@@ -2,7 +2,6 @@ package com.github.database.rider.junit5.util;
import com.github.database.rider.core.util.PropertyResolutionUtil;
import org.hibernate.Session;
-import org.hibernate.internal.SessionImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -119,9 +118,7 @@ public class EntityManagerProvider {
Connection connection;
final EntityTransaction tx = em.getTransaction();
if (isHibernateOnClasspath() && em.getDelegate() instanceof Session) {
- connection = em.unwrap(org.hibernate.engine.spi.SessionImplementor.class).getJdbcCoordinator()
- .getLogicalConnection()
- .getPhysicalConnection();
+ connection = em.unwrap(Session.class).doReturningWork(returningConnection -> returningConnection);
} else {
/**
* see here:http://wiki.eclipse.org/EclipseLink/Examples/JPA/EMAPI#Getting_a_JDBC_Connection_from_an_EntityManager
@@ -254,4 +251,4 @@ public class EntityManagerProvider {
public static boolean isEntityManagerActive() {
return instance != null && em().isOpen();
}
-}
\ No newline at end of file
+}
diff --git a/rider-junit5/src/test/java/com/github/database/rider/junit5/FlywayIt.java b/rider-junit5/src/test/java/com/github/database/rider/junit5/FlywayIt.java
index 40d3f16c..bb4fb7c2 100644
--- a/rider-junit5/src/test/java/com/github/database/rider/junit5/FlywayIt.java
+++ b/rider-junit5/src/test/java/com/github/database/rider/junit5/FlywayIt.java
@@ -32,9 +32,10 @@ public class FlywayIt {
@BeforeAll
public static void initDB(){
- flyway = new Flyway();
- flyway.setDataSource("jdbc:hsqldb:mem:flyway;DB_CLOSE_DELAY=-1", "sa", "");
- flyway.setLocations("filesystem:src/test/resources/migration");
+ flyway = Flyway.configure()
+ .dataSource("jdbc:hsqldb:mem:flyway;DB_CLOSE_DELAY=-1", "sa", "")
+ .locations("filesystem:src/test/resources/migration")
+ .load();
flyway.migrate();
}
@@ -42,7 +43,7 @@ public static void initDB(){
@Test
@DataSet(value = "users.yml",executorId = "flyway")
public void shouldListUsers() throws SQLException {
- try (Statement stmt = flyway.getDataSource().getConnection().createStatement()) {
+ try (Statement stmt = flyway.getConfiguration().getDataSource().getConnection().createStatement()) {
ResultSet resultSet = stmt.executeQuery("select * from user u order by id");
assertThat(resultSet.next()).isTrue();
assertThat(resultSet.getString(2)).isEqualTo("@realpestano");
@@ -53,7 +54,7 @@ public void shouldListUsers() throws SQLException {
@DataSet(cleanBefore = true, transactional = true,executorId = "flyway")
@ExpectedDataSet(value = "usersInserted.yml")
public void shouldInserUsers() throws SQLException {
- Connection connection = flyway.getDataSource().getConnection();
+ Connection connection = flyway.getConfiguration().getDataSource().getConnection();
//connection.setAutoCommit(false); //transactional=true
java.sql.Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
diff --git a/rider-spring/pom.xml b/rider-spring/pom.xml
index ea066893..ac1b37e6 100644
--- a/rider-spring/pom.xml
+++ b/rider-spring/pom.xml
@@ -8,9 +8,6 @@
4.0.0
rider-spring
-
- 5.3.21
-
com.github.database-rider
@@ -21,19 +18,19 @@
org.springframework
spring-context
- ${version.spring}
+ ${spring.framework.version}
provided
org.springframework
spring-jdbc
- ${version.spring}
+ ${spring.framework.version}
provided
org.springframework
spring-test
- ${version.spring}
+ ${spring.framework.version}
provided
@@ -53,16 +50,13 @@
org.apache.maven.plugins
maven-compiler-plugin
- 3.8.1
- 1.8
- 1.8
+ ${maven.compiler.release}
UTF-8
maven-javadoc-plugin
- 3.1.1
attach-javadocs
@@ -72,7 +66,7 @@
- 8
+ ${maven.compiler.release}
@@ -93,4 +87,4 @@
-
\ No newline at end of file
+
diff --git a/rider-spring/src/test/java/com/github/database/rider/spring/dataset/DataSetIt.java b/rider-spring/src/test/java/com/github/database/rider/spring/dataset/DataSetIt.java
index 57b1b412..c4153978 100644
--- a/rider-spring/src/test/java/com/github/database/rider/spring/dataset/DataSetIt.java
+++ b/rider-spring/src/test/java/com/github/database/rider/spring/dataset/DataSetIt.java
@@ -9,8 +9,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
-
-import javax.transaction.Transactional;
+import org.springframework.transaction.annotation.Transactional;
/**
* @author Artemy Osipov
diff --git a/rider-spring/src/test/java/com/github/database/rider/spring/expected/ExpectedDataSetIt.java b/rider-spring/src/test/java/com/github/database/rider/spring/expected/ExpectedDataSetIt.java
index 6416eae2..eb448692 100644
--- a/rider-spring/src/test/java/com/github/database/rider/spring/expected/ExpectedDataSetIt.java
+++ b/rider-spring/src/test/java/com/github/database/rider/spring/expected/ExpectedDataSetIt.java
@@ -1,13 +1,12 @@
package com.github.database.rider.spring.expected;
-import javax.transaction.Transactional;
-
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.TransactionStatus;
+import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionCallbackWithoutResult;
import com.github.database.rider.core.api.dataset.DataSet;