diff --git a/archetype/deltaspike-data-sample/src/main/resources/archetype-resources/pom.xml b/archetype/deltaspike-data-sample/src/main/resources/archetype-resources/pom.xml
index d1da194d13..92e2020998 100644
--- a/archetype/deltaspike-data-sample/src/main/resources/archetype-resources/pom.xml
+++ b/archetype/deltaspike-data-sample/src/main/resources/archetype-resources/pom.xml
@@ -328,6 +328,7 @@
-Aeclipselink.persistencexml=\${basedir}/src/main/resources/META-INF/persistence.xml
+ -Aeclipselink.canonicalmodel.use_generated=false
org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor
diff --git a/core/parser/src/main/java/com/blazebit/persistence/parser/util/JpaMetamodelUtils.java b/core/parser/src/main/java/com/blazebit/persistence/parser/util/JpaMetamodelUtils.java
index ac29aa74cc..db9731db0f 100644
--- a/core/parser/src/main/java/com/blazebit/persistence/parser/util/JpaMetamodelUtils.java
+++ b/core/parser/src/main/java/com/blazebit/persistence/parser/util/JpaMetamodelUtils.java
@@ -322,16 +322,23 @@ public static Class> resolveFieldClass(Class> baseClass, Attribute, ?> att
* with the corresponding primitive type.
* Note that it also returns just "any" type of an id class attribute in case there is no dedicated id class type.
*/
- if (entityType.getIdType() != null) {
- final Class> primitiveIdClass = ReflectionUtils.getPrimitiveClassOfWrapper(entityType.getIdType().getJavaType());
- if (primitiveIdClass == null) {
- // Discover the identifier attributes like this instead for EclipseLink
- Set> idTypes = collectIdAttributes(entityType);
- if (!idTypes.isEmpty()) {
- return idTypes;
+ try {
+ if (entityType.getIdType() != null) {
+ final Class> primitiveIdClass = ReflectionUtils.getPrimitiveClassOfWrapper(entityType.getIdType().getJavaType());
+ if (primitiveIdClass == null) {
+ // Discover the identifier attributes like this instead for EclipseLink
+ Set> idTypes = collectIdAttributes(entityType);
+ if (!idTypes.isEmpty()) {
+ return idTypes;
+ }
+ } else {
+ return Collections.>singleton(entityType.getId(primitiveIdClass));
}
- } else {
- return Collections.>singleton(entityType.getId(primitiveIdClass));
+ }
+ } catch (IllegalArgumentException e2) {
+ // Try again on the super type. Eclipselink is a bit odd in this regard...
+ if (entityType.getSupertype() != null) {
+ return getIdAttributes(entityType.getSupertype());
}
}
throw e;
diff --git a/core/testsuite/pom.xml b/core/testsuite/pom.xml
index a4b3b64ed7..d4a495b336 100644
--- a/core/testsuite/pom.xml
+++ b/core/testsuite/pom.xml
@@ -24,6 +24,7 @@
com.blazebit.persistence.testsuite
2
CoreTestsuite*
+ true
@@ -168,6 +169,7 @@
${maven.test.skip}
${surefireForkCount}
${project.build.directory}/surefire-reports/${surefire.forkNumber}
+ ${useModulePath}
jdbc:h2:mem:core${surefire.forkNumber};DB_CLOSE_DELAY=-1
admin
@@ -213,6 +215,7 @@
${maven.test.skip}
${surefireForkCount}
${project.build.directory}/surefire-reports/${surefire.forkNumber}
+ ${useModulePath}
jdbc:mysql://${dbHost}:3306/information_schema?useUnicode=true&characterEncoding=utf8&databaseTerm=schema&nullDatabaseMeansCurrent=true
root
@@ -255,6 +258,7 @@
${test}
${surefireForkCount}
${project.build.directory}/surefire-reports/${surefire.forkNumber}
+ ${useModulePath}
jdbc:postgresql://${dbHost}:5432/test
postgres
@@ -298,6 +302,7 @@
${maven.test.skip}
${surefireForkCount}
${project.build.directory}/surefire-reports/${surefire.forkNumber}
+ ${useModulePath}
jdbc:db2://${dbHost}:50000/test
db2inst1
@@ -342,6 +347,7 @@
${maven.test.skip}
${surefireForkCount}
${project.build.directory}/surefire-reports/${surefire.forkNumber}
+ ${useModulePath}
jdbc:oracle:thin:@${dbHost}:1521:XE
SYSTEM
@@ -391,6 +397,7 @@
${maven.test.skip}
${surefireForkCount}
${project.build.directory}/surefire-reports/${surefire.forkNumber}
+ ${useModulePath}
jdbc:sqlserver://${dbHost}:1433;trustServerCertificate=true
sa
@@ -742,6 +749,8 @@
com.blazebit.persistence.testsuite.base.jpa.category.NoEclipselink
src/main/basic
+
+ false
@@ -797,6 +806,7 @@
-Aeclipselink.persistencexml=${basedir}/src/main/resources/META-INF/persistence.xml
+ -Aeclipselink.canonicalmodel.use_generated=false
org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor
diff --git a/entity-view/testsuite/pom.xml b/entity-view/testsuite/pom.xml
index 6b7cd58f96..39e50a6961 100644
--- a/entity-view/testsuite/pom.xml
+++ b/entity-view/testsuite/pom.xml
@@ -38,6 +38,7 @@
${surefire.jvm.params.ProxyFactoryTest}
${surefire.jvm.params.AbstractEntityViewTest}
+ true
@@ -150,6 +151,7 @@
${test}
${surefireForkCount}
${project.build.directory}/surefire-reports/${surefire.forkNumber}
+ ${useModulePath}
jdbc:h2:mem:entityview${surefire.forkNumber};DB_CLOSE_DELAY=-1
admin
@@ -192,6 +194,7 @@
${test}
${surefireForkCount}
${project.build.directory}/surefire-reports/${surefire.forkNumber}
+ ${useModulePath}
jdbc:mysql://${dbHost}:3306/information_schema?useUnicode=true&characterEncoding=utf8&databaseTerm=schema&nullDatabaseMeansCurrent=true
root
@@ -233,6 +236,7 @@
${test}
${surefireForkCount}
${project.build.directory}/surefire-reports/${surefire.forkNumber}
+ ${useModulePath}
jdbc:postgresql://${dbHost}:5432/test
postgres
@@ -274,6 +278,7 @@
${test}
${surefireForkCount}
${project.build.directory}/surefire-reports/${surefire.forkNumber}
+ ${useModulePath}
jdbc:db2://${dbHost}:50000/test:progressiveStreaming=2;
db2inst1
@@ -317,6 +322,7 @@
${test}
${surefireForkCount}
${project.build.directory}/surefire-reports/${surefire.forkNumber}
+ ${useModulePath}
jdbc:oracle:thin:@${dbHost}:1521:XE
SYSTEM
@@ -365,6 +371,7 @@
${test}
${surefireForkCount}
${project.build.directory}/surefire-reports/${surefire.forkNumber}
+ ${useModulePath}
jdbc:sqlserver://${dbHost}:1433;trustServerCertificate=true
sa
@@ -712,6 +719,8 @@
eclipselink
com.blazebit.persistence.testsuite.base.jpa.category.NoEclipselink
+
+ false
@@ -774,6 +783,7 @@
-Aeclipselink.persistencexml=${basedir}/src/test/resources/META-INF/persistence.xml
+ -Aeclipselink.canonicalmodel.use_generated=false
org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor
diff --git a/examples/deltaspike-data-rest/pom.xml b/examples/deltaspike-data-rest/pom.xml
index 7364856be1..a2a54fd4c4 100644
--- a/examples/deltaspike-data-rest/pom.xml
+++ b/examples/deltaspike-data-rest/pom.xml
@@ -372,6 +372,7 @@
-Aeclipselink.persistencexml=${basedir}/src/main/resources/META-INF/persistence.xml
+ -Aeclipselink.canonicalmodel.use_generated=false
org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor
diff --git a/integration/deltaspike-data/testsuite/pom.xml b/integration/deltaspike-data/testsuite/pom.xml
index 9f0dc7a239..e354e371f2 100644
--- a/integration/deltaspike-data/testsuite/pom.xml
+++ b/integration/deltaspike-data/testsuite/pom.xml
@@ -663,6 +663,7 @@
-Aeclipselink.persistencexml=${basedir}/src/main/resources/META-INF/persistence.xml
+ -Aeclipselink.canonicalmodel.use_generated=false
org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor
diff --git a/integration/eclipselink/src/main/java/com/blazebit/persistence/integration/eclipselink/EclipseLinkJpaProvider.java b/integration/eclipselink/src/main/java/com/blazebit/persistence/integration/eclipselink/EclipseLinkJpaProvider.java
index 29fe21ae5a..c4e97021e5 100644
--- a/integration/eclipselink/src/main/java/com/blazebit/persistence/integration/eclipselink/EclipseLinkJpaProvider.java
+++ b/integration/eclipselink/src/main/java/com/blazebit/persistence/integration/eclipselink/EclipseLinkJpaProvider.java
@@ -532,10 +532,13 @@ private ClassDescriptor getDescriptor(ManagedType> type) {
}
private DatabaseMapping getDatabaseMapping(ManagedType> type, String attributeName) {
+ ClassDescriptor t = descriptors.get( type.getJavaType() );
+ if (t == null) {
+ return null;
+ }
if (attributeName.indexOf('.') == -1) {
return descriptors.get( type.getJavaType() ).getMappingForAttributeName( attributeName );
}
- ClassDescriptor t = descriptors.get( type.getJavaType() );
DatabaseMapping attr = null;
String[] parts = attributeName.split("\\.");
for (int i = 0; i < parts.length; i++) {
@@ -553,6 +556,9 @@ private DatabaseMapping getDatabaseMapping(ManagedType> type, String attribute
}
attr = attribute;
t = attribute.getReferenceDescriptor();
+ if (t == null && attribute instanceof ForeignReferenceMapping) {
+ t = descriptors.get( ( (ForeignReferenceMapping) attribute).getReferenceClass() );
+ }
}
return attr;
diff --git a/integration/querydsl/testsuite/pom.xml b/integration/querydsl/testsuite/pom.xml
index 6cb3bb2085..f75f9465b7 100644
--- a/integration/querydsl/testsuite/pom.xml
+++ b/integration/querydsl/testsuite/pom.xml
@@ -574,6 +574,7 @@
-Aeclipselink.persistencexml=${basedir}/src/main/resources/META-INF/persistence.xml
+ -Aeclipselink.canonicalmodel.use_generated=false
org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor
diff --git a/integration/spring-hateoas/webmvc/pom.xml b/integration/spring-hateoas/webmvc/pom.xml
index 44c7ebdb4b..265ea549d2 100644
--- a/integration/spring-hateoas/webmvc/pom.xml
+++ b/integration/spring-hateoas/webmvc/pom.xml
@@ -18,6 +18,7 @@
${version.spring-data-3.3-spring-boot}
${version.spring-data-3.3}
2.2.2
+ ${version.hibernate-6.6}
17
diff --git a/jpa-criteria/testsuite/pom.xml b/jpa-criteria/testsuite/pom.xml
index 03730f2cdf..71a82912a7 100644
--- a/jpa-criteria/testsuite/pom.xml
+++ b/jpa-criteria/testsuite/pom.xml
@@ -512,6 +512,7 @@
-Aeclipselink.persistencexml=${basedir}/src/test/resources/META-INF/persistence.xml
+ -Aeclipselink.canonicalmodel.use_generated=false
org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor
diff --git a/testsuite-base/eclipselink/pom.xml b/testsuite-base/eclipselink/pom.xml
index b48a3dadd5..2da0dc1f03 100644
--- a/testsuite-base/eclipselink/pom.xml
+++ b/testsuite-base/eclipselink/pom.xml
@@ -20,7 +20,7 @@
Blazebit Persistence Testsuite Base EclipseLink
- com.blazebit.persistence.testsuite.base.eclipselink
+ com.blazebit.persistence.testsuite.base
diff --git a/testsuite-base/eclipselink/src/main/java/module-info.java b/testsuite-base/eclipselink/src/main/java/module-info.java
new file mode 100644
index 0000000000..26e3efa46d
--- /dev/null
+++ b/testsuite-base/eclipselink/src/main/java/module-info.java
@@ -0,0 +1,11 @@
+/*
+ * SPDX-License-Identifier: Apache-2.0
+ * Copyright Blazebit
+ */
+module com.blazebit.persistence.testsuite.base {
+ requires java.naming;
+ requires eclipselink;
+ requires com.blazebit.persistence.testsuite.base.jpa;
+ requires com.blazebit.persistence.core;
+ exports com.blazebit.persistence.testsuite.base;
+}
\ No newline at end of file