https://github.com/apache/openjpa/blob/master/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestUuidGeneratedEntity.java
from mobile (sorry for typos ;) On Wed, Mar 26, 2025, 22:08 Maxim Solodovnik <solomax...@gmail.com> wrote: > Hello Robert, > > from mobile (sorry for typos ;) > > > On Wed, Mar 26, 2025, 20:57 Robert <teh...@take3.ro> wrote: > >> Hello Maxim, >> >> i have 2 problems to use JPA31 with OpenJPA 4.1.0. >> >> 1) persistence.xml >> >> Because there doesn't exist a persistence_3_1.xsd (even on jakarta.ee) i >> use persistence_3_0.xsd (as i read it is compatible), but the following >> snippet doesn't work: >> >> <persistence version="3.1" xmlns="https://jakarta.ee/xml/ns/persistence" >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >> xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence >> https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd"> >> ... >> </persistence> >> > > I believe the version attribute should be "3.0" here (the same as in xsd > file name) > > Version 3.1 can be handled > I just didn't thought it should be done :) > My rationale was: XSD version wasn't changed so attribute should stay ad > 3.0 > > >> The schema verifier doesn't like this, with eclipselink 4.0.5 the snippet >> is working. >> >> I solved this with this small patch (simply deleting the fixed="3.0"): >> >> --- >> a/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/persistence_3_0.xsd.rsrc >> +++ >> b/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/persistence_3_0.xsd.rsrc >> @@ -283,7 +283,7 @@ >> </xsd:element> >> </xsd:sequence> >> <xsd:attribute name="version" type="persistence:versionType" >> - fixed="3.0" use="required"/> >> + use="required"/> >> </xsd:complexType> >> </xsd:element>--- >> a/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/persistence_3_0.xsd.rsrc >> +++ >> b/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/persistence_3_0.xsd.rsrc >> @@ -283,7 +283,7 @@ >> </xsd:element> >> </xsd:sequence> >> <xsd:attribute name="version" type="persistence:versionType" >> - fixed="3.0" use="required"/> >> + use="required"/> >> </xsd:complexType> >> </xsd:element> >> >> 2) @GeneratedValue (AUTO and UUID) >> >> An entity with: >> >> ... >> @Id >> @GeneratedValue(strategy = GenerationType.UUID) >> private UUID id; >> ... >> >> is not working - throwing an exception: >> org.apache.openjpa.persistence.PersistenceException: Cannot invoke >> "Object.getClass()" because "val" is null >> at ro.take3.jpatest.Test01EntityTest.testPersist(Test01EntityTest.java:60) >> >> ... >> @Id >> // @GeneratedValue(strategy = GenerationType.UUID) >> private UUID id = UUID.randomUUID(); >> ... >> >> seems to work. >> >> Is this an OpenJPA issue or am i doing something wrong? >> > > There are working tests, I can check a bit later > > >> Best regards, Robert >> >> -- >> >> Robert <teh...@take3.ro> >> >>