Skip to content

Commit

Permalink
Fix a bunch of CI issues encountered with EclipseLink
Browse files Browse the repository at this point in the history
  • Loading branch information
beikov committed Nov 9, 2024
1 parent 3894573 commit e560946
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@
</annotationProcessorPaths>
<compilerArgs>
<compilerArg>-Aeclipselink.persistencexml=\${basedir}/src/main/resources/META-INF/persistence.xml</compilerArg>
<compilerArg>-Aeclipselink.canonicalmodel.use_generated=false</compilerArg>
</compilerArgs>
<annotationProcessors>
<processor>org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor</processor>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<SingularAttribute<?, ?>> 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<SingularAttribute<?, ?>> idTypes = collectIdAttributes(entityType);
if (!idTypes.isEmpty()) {
return idTypes;
}
} else {
return Collections.<SingularAttribute<?, ?>>singleton(entityType.getId(primitiveIdClass));
}
} else {
return Collections.<SingularAttribute<?, ?>>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;
Expand Down
10 changes: 10 additions & 0 deletions core/testsuite/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<testBasePackage>com.blazebit.persistence.testsuite</testBasePackage>
<surefireForkCount>2</surefireForkCount>
<test>CoreTestsuite*</test>
<useModulePath>true</useModulePath>
</properties>

<dependencies>
Expand Down Expand Up @@ -168,6 +169,7 @@
<skip>${maven.test.skip}</skip>
<forkCount>${surefireForkCount}</forkCount>
<reportsDirectory>${project.build.directory}/surefire-reports/${surefire.forkNumber}</reportsDirectory>
<useModulePath>${useModulePath}</useModulePath>
<systemPropertyVariables>
<jdbc.url>jdbc:h2:mem:core${surefire.forkNumber};DB_CLOSE_DELAY=-1</jdbc.url>
<jdbc.user>admin</jdbc.user>
Expand Down Expand Up @@ -213,6 +215,7 @@
<skip>${maven.test.skip}</skip>
<forkCount>${surefireForkCount}</forkCount>
<reportsDirectory>${project.build.directory}/surefire-reports/${surefire.forkNumber}</reportsDirectory>
<useModulePath>${useModulePath}</useModulePath>
<systemPropertyVariables>
<jdbc.url>jdbc:mysql://${dbHost}:3306/information_schema?useUnicode=true&amp;characterEncoding=utf8&amp;databaseTerm=schema&amp;nullDatabaseMeansCurrent=true</jdbc.url>
<jdbc.user>root</jdbc.user>
Expand Down Expand Up @@ -255,6 +258,7 @@
<test>${test}</test>
<forkCount>${surefireForkCount}</forkCount>
<reportsDirectory>${project.build.directory}/surefire-reports/${surefire.forkNumber}</reportsDirectory>
<useModulePath>${useModulePath}</useModulePath>
<systemPropertyVariables>
<jdbc.url>jdbc:postgresql://${dbHost}:5432/test</jdbc.url>
<jdbc.user>postgres</jdbc.user>
Expand Down Expand Up @@ -298,6 +302,7 @@
<skip>${maven.test.skip}</skip>
<forkCount>${surefireForkCount}</forkCount>
<reportsDirectory>${project.build.directory}/surefire-reports/${surefire.forkNumber}</reportsDirectory>
<useModulePath>${useModulePath}</useModulePath>
<systemPropertyVariables>
<jdbc.url>jdbc:db2://${dbHost}:50000/test</jdbc.url>
<jdbc.user>db2inst1</jdbc.user>
Expand Down Expand Up @@ -342,6 +347,7 @@
<skip>${maven.test.skip}</skip>
<forkCount>${surefireForkCount}</forkCount>
<reportsDirectory>${project.build.directory}/surefire-reports/${surefire.forkNumber}</reportsDirectory>
<useModulePath>${useModulePath}</useModulePath>
<systemPropertyVariables>
<jdbc.url>jdbc:oracle:thin:@${dbHost}:1521:XE</jdbc.url>
<jdbc.user>SYSTEM</jdbc.user>
Expand Down Expand Up @@ -391,6 +397,7 @@
<skip>${maven.test.skip}</skip>
<forkCount>${surefireForkCount}</forkCount>
<reportsDirectory>${project.build.directory}/surefire-reports/${surefire.forkNumber}</reportsDirectory>
<useModulePath>${useModulePath}</useModulePath>
<systemPropertyVariables>
<jdbc.url>jdbc:sqlserver://${dbHost}:1433;trustServerCertificate=true</jdbc.url>
<jdbc.user>sa</jdbc.user>
Expand Down Expand Up @@ -742,6 +749,8 @@
<properties>
<jpa.excludedGroups>com.blazebit.persistence.testsuite.base.jpa.category.NoEclipselink</jpa.excludedGroups>
<additional.source.directory>src/main/basic</additional.source.directory>
<!-- Looks like EclipseLink isn't really made for running in module mode -->
<useModulePath>false</useModulePath>
</properties>
<dependencies>
<dependency>
Expand Down Expand Up @@ -797,6 +806,7 @@
</annotationProcessorPaths>
<compilerArgs>
<compilerArg>-Aeclipselink.persistencexml=${basedir}/src/main/resources/META-INF/persistence.xml</compilerArg>
<compilerArg>-Aeclipselink.canonicalmodel.use_generated=false</compilerArg>
</compilerArgs>
<annotationProcessors>
<processor>org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor</processor>
Expand Down
10 changes: 10 additions & 0 deletions entity-view/testsuite/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
${surefire.jvm.params.ProxyFactoryTest}
${surefire.jvm.params.AbstractEntityViewTest}
</surefire.jvm.params>
<useModulePath>true</useModulePath>
</properties>

<dependencies>
Expand Down Expand Up @@ -150,6 +151,7 @@
<test>${test}</test>
<forkCount>${surefireForkCount}</forkCount>
<reportsDirectory>${project.build.directory}/surefire-reports/${surefire.forkNumber}</reportsDirectory>
<useModulePath>${useModulePath}</useModulePath>
<systemPropertyVariables>
<jdbc.url>jdbc:h2:mem:entityview${surefire.forkNumber};DB_CLOSE_DELAY=-1</jdbc.url>
<jdbc.user>admin</jdbc.user>
Expand Down Expand Up @@ -192,6 +194,7 @@
<test>${test}</test>
<forkCount>${surefireForkCount}</forkCount>
<reportsDirectory>${project.build.directory}/surefire-reports/${surefire.forkNumber}</reportsDirectory>
<useModulePath>${useModulePath}</useModulePath>
<systemPropertyVariables>
<jdbc.url>jdbc:mysql://${dbHost}:3306/information_schema?useUnicode=true&amp;characterEncoding=utf8&amp;databaseTerm=schema&amp;nullDatabaseMeansCurrent=true</jdbc.url>
<jdbc.user>root</jdbc.user>
Expand Down Expand Up @@ -233,6 +236,7 @@
<test>${test}</test>
<forkCount>${surefireForkCount}</forkCount>
<reportsDirectory>${project.build.directory}/surefire-reports/${surefire.forkNumber}</reportsDirectory>
<useModulePath>${useModulePath}</useModulePath>
<systemPropertyVariables>
<jdbc.url>jdbc:postgresql://${dbHost}:5432/test</jdbc.url>
<jdbc.user>postgres</jdbc.user>
Expand Down Expand Up @@ -274,6 +278,7 @@
<test>${test}</test>
<forkCount>${surefireForkCount}</forkCount>
<reportsDirectory>${project.build.directory}/surefire-reports/${surefire.forkNumber}</reportsDirectory>
<useModulePath>${useModulePath}</useModulePath>
<systemPropertyVariables>
<jdbc.url>jdbc:db2://${dbHost}:50000/test:progressiveStreaming=2;</jdbc.url>
<jdbc.user>db2inst1</jdbc.user>
Expand Down Expand Up @@ -317,6 +322,7 @@
<test>${test}</test>
<forkCount>${surefireForkCount}</forkCount>
<reportsDirectory>${project.build.directory}/surefire-reports/${surefire.forkNumber}</reportsDirectory>
<useModulePath>${useModulePath}</useModulePath>
<systemPropertyVariables>
<jdbc.url>jdbc:oracle:thin:@${dbHost}:1521:XE</jdbc.url>
<jdbc.user>SYSTEM</jdbc.user>
Expand Down Expand Up @@ -365,6 +371,7 @@
<test>${test}</test>
<forkCount>${surefireForkCount}</forkCount>
<reportsDirectory>${project.build.directory}/surefire-reports/${surefire.forkNumber}</reportsDirectory>
<useModulePath>${useModulePath}</useModulePath>
<systemPropertyVariables>
<jdbc.url>jdbc:sqlserver://${dbHost}:1433;trustServerCertificate=true</jdbc.url>
<jdbc.user>sa</jdbc.user>
Expand Down Expand Up @@ -712,6 +719,8 @@
<id>eclipselink</id>
<properties>
<jpa.excludedGroups>com.blazebit.persistence.testsuite.base.jpa.category.NoEclipselink</jpa.excludedGroups>
<!-- Looks like EclipseLink isn't really made for running in module mode -->
<useModulePath>false</useModulePath>
</properties>
<dependencies>
<dependency>
Expand Down Expand Up @@ -774,6 +783,7 @@
</annotationProcessorPaths>
<compilerArgs>
<compilerArg>-Aeclipselink.persistencexml=${basedir}/src/test/resources/META-INF/persistence.xml</compilerArg>
<compilerArg>-Aeclipselink.canonicalmodel.use_generated=false</compilerArg>
</compilerArgs>
<annotationProcessors>
<processor>org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor</processor>
Expand Down
1 change: 1 addition & 0 deletions examples/deltaspike-data-rest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@
</annotationProcessorPaths>
<compilerArgs>
<compilerArg>-Aeclipselink.persistencexml=${basedir}/src/main/resources/META-INF/persistence.xml</compilerArg>
<compilerArg>-Aeclipselink.canonicalmodel.use_generated=false</compilerArg>
</compilerArgs>
<annotationProcessors>
<processor>org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor</processor>
Expand Down
1 change: 1 addition & 0 deletions integration/deltaspike-data/testsuite/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@
</annotationProcessorPaths>
<compilerArgs>
<compilerArg>-Aeclipselink.persistencexml=${basedir}/src/main/resources/META-INF/persistence.xml</compilerArg>
<compilerArg>-Aeclipselink.canonicalmodel.use_generated=false</compilerArg>
</compilerArgs>
<annotationProcessors>
<processor>org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor</processor>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand All @@ -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;
Expand Down
1 change: 1 addition & 0 deletions integration/querydsl/testsuite/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@
</annotationProcessorPaths>
<compilerArgs>
<compilerArg>-Aeclipselink.persistencexml=${basedir}/src/main/resources/META-INF/persistence.xml</compilerArg>
<compilerArg>-Aeclipselink.canonicalmodel.use_generated=false</compilerArg>
</compilerArgs>
<annotationProcessors>
<processor>org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor</processor>
Expand Down
1 change: 1 addition & 0 deletions integration/spring-hateoas/webmvc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<version.spring-boot>${version.spring-data-3.3-spring-boot}</version.spring-boot>
<version.spring-data>${version.spring-data-3.3}</version.spring-data>
<version.spring-hateoas>2.2.2</version.spring-hateoas>
<version.hibernate>${version.hibernate-6.6}</version.hibernate>
<main.java.version>17</main.java.version>
</properties>

Expand Down
1 change: 1 addition & 0 deletions jpa-criteria/testsuite/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@
</annotationProcessorPaths>
<compilerArgs>
<compilerArg>-Aeclipselink.persistencexml=${basedir}/src/test/resources/META-INF/persistence.xml</compilerArg>
<compilerArg>-Aeclipselink.canonicalmodel.use_generated=false</compilerArg>
</compilerArgs>
<annotationProcessors>
<processor>org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor</processor>
Expand Down
2 changes: 1 addition & 1 deletion testsuite-base/eclipselink/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<name>Blazebit Persistence Testsuite Base EclipseLink</name>

<properties>
<module.name>com.blazebit.persistence.testsuite.base.eclipselink</module.name>
<module.name>com.blazebit.persistence.testsuite.base</module.name>
</properties>

<dependencies>
Expand Down
11 changes: 11 additions & 0 deletions testsuite-base/eclipselink/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit e560946

Please sign in to comment.