Skip to content
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

[NETBEANS-5472] Bugfix: Updated maven archetype #5516

Closed
wants to merge 1 commit into from

Conversation

asbachb
Copy link
Collaborator

@asbachb asbachb commented Feb 16, 2023

Updated maven archetype to build jakarta ee 10 webapp to latest bugfix version.

This version contains the correct java persistence version 3.1 (was 3.0).

This fixes #5472

…e 10 webapp to latest bugfix version

This version contains the correct java persistence version `3.1` (was `3.0`).
@mbien mbien added the Java EE/Jakarta EE [ci] enable enterprise job label Feb 16, 2023
@mbien mbien added this to the NB18 milestone Feb 16, 2023
@matthiasblaesing
Copy link
Contributor

I understand, that this is about the version in persistence.xml. So I had a look at it and from my POV it is broken now:

<persistence xmlns="https://jakarta.ee/xml/ns/persistence" 
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             version="3.1" 
             xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_1.xsd"
             >
	<!--  Define Persistence Unit  -->
	<persistence-unit name="my_persistence_unit"> </persistence-unit>
</persistence>

The issue is the fourth line (I added linebreaks). The schema location points into the void. Try to open https://jakarta.ee/xml/ns/persistence/persistence_3_1.xsd, you'll get a 404 which defeats the purpose of xsi:schemaLocation.

This seems to be still in discussion:

From my POV 3.1 is broken. The 3.0 schema can't be applied as it requires a fixed version of 3.0 and there is no other.

@matthiasblaesing
Copy link
Contributor

@pepness @jGauravGupta do you know how current Jakarta EE 10 servers react to such files? Do they just ignore the schema location?

@asbachb
Copy link
Collaborator Author

asbachb commented Feb 16, 2023

I see. Actually I was not aware about the situation. I also thought there is a new schema based on the released spec.

@asbachb asbachb marked this pull request as draft February 16, 2023 23:14
@pepness
Copy link
Member

pepness commented Feb 17, 2023

@matthiasblaesing, There is no support for JPA 2.2 and onwards, if you delete the persistence.xml file that was generated when you create the maven project, you can only create a new persistence unit with up to version 2.1. I am currently working on a PR that will give support for JPA 2.2, I will include partial support for JPA 3.0 and JPA 3.1 that will generate correct persistence.xml files.

@matthiasblaesing
Copy link
Contributor

@pepness sorry, there is a misunderstanding. What I meant was, that the proposed content of persistence.xml can't be validated, as there is no grammar for 3.1 available. JPA 3.1 was released and the argumentation was, that the grammar did not need to change, but it was overlooked, that the value of the version property of the root XML element persistence is hard coded in the grammar:

      <xsd:attribute name="version" type="persistence:versionType" 
                     fixed="3.0" use="required"/>

So if you validate the suggested 3.1 persistence.xml against https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd validation will fail and a grammar for 3.1 is not available.

So what I'm interested in how payara, jboss, glassfish and Wildfly handle this situation: Do they fail with 3.1 persistence.xml or do they just ignore this validation failure or do they skip validation alltogether?

@neilcsmith-net neilcsmith-net modified the milestones: NB18, NB19 Apr 18, 2023
@asbachb
Copy link
Collaborator Author

asbachb commented May 14, 2023

As this is an "issue" on JPA Specification site. I'll close the PR.

@asbachb asbachb closed this May 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Java EE/Jakarta EE [ci] enable enterprise job
Projects
Development

Successfully merging this pull request may close these issues.

Version of JPA for Jakarta EE10 is 3.1, not 3.0
5 participants