-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Upgrade to the Quarkus 3.24.2 version #40867
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Closes keycloak#40592 Signed-off-by: Martin Bartoš <mabartos@redhat.com>
Unreported flaky test detectedIf the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR. org.keycloak.testsuite.cluster.SessionFailoverClusterTest#sessionFailover
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unreported flaky test detected, please review
Failures to Operator seem related to: #40932 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some comments for better review of these changes.
Changes of the JpaUtils
can only be verified when running Keycloak on Undertow as it is used with the DefaultJpaConnectionProviderFactory
which is replaced with QuarkusJpaConnectionProviderFactory
for Keycloak on Quarkus. For Quarkus, we already know the persistence units gather in the KeycloakProcessor
.
@yrodiere May I ask you for a brief review of the Hibernate 7 changes for the PersistenceXmlParser? I see that you did some changes on the Quarkus side, so it'd be great if you could check this. Thank you very much!
List<ParsedPersistenceXmlDescriptor> persistenceUnits = new ArrayList<>(PersistenceXmlParser.locatePersistenceUnits(properties)); | ||
PersistenceXmlParser parser = PersistenceXmlParser.create(properties); | ||
List<URL> urls = parser.getClassLoaderService().locateResources("META-INF/persistence.xml"); | ||
|
||
persistenceUnits.add(PersistenceXmlParser.locateIndividualPersistenceUnit(JpaUtils.class.getClassLoader().getResource("default-persistence.xml"))); | ||
List<ParsedPersistenceXmlDescriptor> persistenceUnits = urls.isEmpty() ? new ArrayList<>() : transformPersistenceUnits(parser.parse(urls).values()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mimic the behavior of the PersistenceXmlParser#locatePersistenceUnits with the new approach for locating all these persistence.xml
resources - inspired by the HibernateOrmProcessor#parsePersistenceXmlDescriptors in Quarkus.
@@ -56,11 +61,22 @@ public static String getTableNameForNativeQuery(String tableName, EntityManager | |||
return (schema==null) ? tableName : dialect.openQuote() + schema + dialect.closeQuote() + "." + tableName; | |||
} | |||
|
|||
private static List<ParsedPersistenceXmlDescriptor> transformPersistenceUnits(Collection<PersistenceUnitDescriptor> descriptors) { | |||
return descriptors.stream().map(descriptor -> (ParsedPersistenceXmlDescriptor) descriptor).collect(Collectors.toList()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Persistence unit descriptor is always ParsedPersistenceXmlDescriptor
when parsed from the persistence XML -> see https://github.com/hibernate/hibernate-orm/blob/7.0.5/hibernate-core/src/main/java/org/hibernate/jpa/boot/spi/PersistenceXmlParser.java#L181
|
||
persistenceUnits.add(PersistenceXmlParser.locateIndividualPersistenceUnit(JpaUtils.class.getClassLoader().getResource("default-persistence.xml"))); | ||
List<ParsedPersistenceXmlDescriptor> persistenceUnits = urls.isEmpty() ? new ArrayList<>() : transformPersistenceUnits(parser.parse(urls).values()); | ||
ParsedPersistenceXmlDescriptor defaultPersistenceUnit = transformPersistenceUnits(parser.parse(Collections.singletonList(JpaUtils.class.getClassLoader().getResource("default-persistence.xml")), txType) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrap as a singletonList
to be able to use the custom NoSuchElementException
specified below. List.of() might potentially throw NPE, and we would not have the exact information about the failure.
I can share the reasoning if necessary.
ParsedPersistenceXmlDescriptor descriptor = PersistenceXmlParser.locateIndividualPersistenceUnit( | ||
Thread.currentThread().getContextClassLoader().getResource("default-persistence.xml")); | ||
PersistenceXmlParser parser = PersistenceXmlParser.create(); | ||
PersistenceUnitDescriptor descriptor = parser.parse(Collections.singletonList(parser.getClassLoaderService().locateResource("default-persistence.xml"))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as described for the JPAUtils.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Closes #40592