Skip to content

JavaxPersistenceXmlToJakartaPersistenceXml finds persistence descriptors by namespace instead of file name - #1269

Merged
jkschneider merged 1 commit into
jakarta/jersey-3from
jakarta/persistence-descriptor-namespace
Oct 4, 2026
Merged

jkschneider merged 1 commit into
jakarta/jersey-3from
jakarta/persistence-descriptor-namespace

Conversation

@jkschneider

Copy link
Copy Markdown
Member

The recipe only looked at files named persistence.xml, so descriptors kept under other names, such as Arquillian's test-persistence.xml, stayed on the Java EE namespace and version 2.0. Its precondition now matches any XML document whose root is persistence in the http://java.sun.com/xml/ns/persistence or http://xmlns.jcp.org/xml/ns/persistence namespace, whatever the file is called. Unrelated XML with a persistence root is left alone, and so is a persistence.xml already on the Jakarta namespace, which the file name check used to set back to version 3.0 even when it was 3.2.

Found by a team of coding agents reviewing a Moderne run of org.openrewrite.java.migrate.jakarta.JavaxMigrationToJakarta over the 31 Arquillian repositories (run 20261003120559-YQoma). The issue is custom-persistence-descriptor-skipped in the run's io.moderne.RecipeIssues data table (10 rows), and the fix was discussed and reviewed on the run's message board. A row from the table, as a generalized example:

Persistence descriptors packaged under a different filename are left in the Java EE namespace. (arquillian/arquillian-extension-persistence, int-tests/src/test/resources-wildfly-8.1.0/test-persistence.xml, recipe org.openrewrite.java.migrate.jakarta.JavaxMigrationToJakarta)

Before:

// src/test/resources/test-persistence.xml
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0"/>

What the recipe produced:

// src/test/resources/test-persistence.xml
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0"/>

Expected:

// src/test/resources/test-persistence.xml
<persistence xmlns="https://jakarta.ee/xml/ns/persistence" version="3.0"/>

Stacked on #1268 (6 of 19); merge that one first.

@jkschneider
jkschneider force-pushed the jakarta/persistence-descriptor-namespace branch from 80d4f01 to 575baa1 Compare October 3, 2026 22:26
@jkschneider
jkschneider added this pull request to stack #1284 October 4, 2026 09:43
@jkschneider
jkschneider merged commit 6a4a56d into main Oct 4, 2026
1 check passed
@jkschneider
jkschneider deleted the jakarta/persistence-descriptor-namespace branch October 4, 2026 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant