Implements Jakarta Persistence 3.2 - #144
Conversation
* Reverting unnecessary changes * Fixing broken map synchronization
* Changing signature of BrokerFactory API on schema dealing validate method * Adding test to check if validate operation throws exception when it fails * Changing GH CI workflow to allow usage of both self-hosted and GH hosted runners * Tested on derby, h2-2, postgresql:latest, mysql:lts, mariadb:lts
* Implementing emf creation passing PersistenceConfiguration
* Removing unused import in BrokerImpl * Implemented new PersistenceUnitUtil load methods
* Moved PUU loading tests to test unit already present * Updated test unit to junit 4.x format
* Original impl was wrongfully dependent of persistence.xml file * Fixed this issue, but still lacking actual conversion of PersistenceConfiguration properties to openjpa corresponding properties
…iguration) method
* added update OracleDictionary to use unqualified table name from main * added temporary file information disclosure vul-fix from main
…tence.xml * Added tests of specifications supported * Added support for scope and qualifiers in PersistenceUnitInfo and persistence.xml
Added function and corresponding tests, but MySQL still fails in tests. Passed on h2-2, pg, mariadb.
* fixed behavior on MySQL * tested on derbdb, h2-2, mysql lts, mariadb lts, postgresql
|
How do you run the tests exactly? They require quite a lot of properties 🙃 |
|
I'm using: As I understand for some reason |
|
@solomax I looked into the That's also why the TCK runs this single test in the separate Re Verified A/B/A on |
|
You are right @rzo1, for whatever reason the test was red for me Reverted and I'll try to add parametrization and perform more tests |
|
I am currently looking into my suggestion regarding Romains comment. |
…thout a version, so optimistic lock failures still surface Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Just commited updated My results are: I'll try to take a look at all this later :) |
|
Kubernetes flukes aside, Oracle build is now green, skipping only tests where there is no database support (TIME data type, CURRENT_TIME and EXTRACT(QUARTER from)). Ran the tests on oracle-xe-18 and oracle-xe-21. |
|
It seems some errors in MySQL TCK tests are caused by: While trying to persist entity with: @Column(name = "CHARDATA")
protected char characterData;Table is create with: CREATE TABLE DATATYPES (ID INTEGER NOT NULL, BOOLEANDATA SMALLINT NULL, CHARDATA CHAR NULL, SHORTDATA SMALLINT NULL, INTDATA INTEGER NULL, INTDATA2 INTEGER NULL, LONGDATA NUMERIC NULL, DBLDATA DOUBLE PRECISION NULL, FLOATDATA REAL NULL, ENUMODATA INTEGER NULL, ENUMSDATA VARCHAR(25), BYTEDATA SMALLINT NULL, TRANS SMALLINT NULL, BYTEARRAYDATA BLOB, CHARARRAYDATA VARCHAR(448), CONSTRAINT PK_DATATYPES PRIMARY KEY (ID) ) ENGINE=innoDB DEFAULT CHARSET=latin1 !java oblect is created with: char[] cArray = { 'a' };
byte[] bArray = { (byte) 100 };
d1 = new DataTypes(1, false, (byte) 100, 'a', (short) 100, 300, 600L, 50D, 1.0F, cArray, bArray);Something weird :((( |
OpenJPA historically never passed the full TCK - so we can either try to get it green (again) for certain rdbms or we make a (pre?) release with updated docs and do the TCK work in another follow up PR? wdyt? |
solomax
left a comment
There was a problem hiding this comment.
+1 to merge this PR as is (with squash and merge, I guess)
And to continue polishing in next PRs :))
@rmannibucau I would appreciate your approve as well
BTW I will be on vacation for a week or so, so might be silent :)
|
+1 to merge and create a release candidate, but I guess it would be better to keep the commit history instead of squashing it to allow future fixes. |
|
@solomax, did openjpa pass the TCK in others DBs? |
rmannibucau
left a comment
There was a problem hiding this comment.
The 90 comments tagged (high)/(medium)/(low) below were prepared with the help of Claude; the untagged ones are mine. Points already discussed in existing threads were deliberately skipped.
| <goals> | ||
| <goal>unpack</goal> | ||
| </goals> | ||
| <?m2e ignore?> |
There was a problem hiding this comment.
really needed? it is out of maven schema anyway, no comment flavor?
| exit 1 | ||
| fi | ||
|
|
||
| stopAll() { |
There was a problem hiding this comment.
(medium) stopAll runs unconditionally at startup and issues docker:stop with name patterns like postgres*/mysql* for all four DB profiles, even when DB_HOST points at an external database - that can kill unrelated containers on a developer machine and adds four mvn invocations per run. Suggest guarding with START_DOCKER and limiting to the selected DB_TYPE.
There was a problem hiding this comment.
@rmannibucau (this one is mine :))))
this call was added to stop all stalled dockers from previous runs (better to use trap and perform clean-up, but this dirty solution much easier :)))
I would leave it as-is but also can change if you insist :)
| fi | ||
|
|
||
| echo "" | ||
| echo "=== Preparing ${DB_TYPE} database ===" |
There was a problem hiding this comment.
(low) "=== Preparing ${DB_TYPE} database ===" is an empty leftover (Step 5 is missing between Step 4 and Step 6), yet the README claims this step drops stale tables and creates stored procedures. Either implement it or drop the heading and fix the README.
There was a problem hiding this comment.
I'll perform clean-up (missing DB tables are being created by maven and dropped by docker:remove ...)
| @@ -1163,7 +1164,7 @@ data structure. | |||
| lifecycle callbacks | |||
| </seealso> | |||
| </indexterm> | |||
| <ulink url="http://download.oracle.com/javaee/6/api/javax/persistence/PreUpdate.html"> | |||
| <ulink url="https://jakarta.ee/specifications/persistence/3.2/apidocs/jakarta.persistence/jakarta/persistence/postupdate"> | |||
There was a problem hiding this comment.
(low) Copy/paste nit: the PreUpdate entry links to .../jakarta/persistence/postupdate - should be preupdate (line 1191 is the correct PostUpdate one).
| <id>openjpa</id> | ||
| <properties> | ||
| <glassfish-artifact-id>glassfish</glassfish-artifact-id> | ||
| <openjpa.version>4.2.0-SNAPSHOT</openjpa.version> |
There was a problem hiding this comment.
(low) The injected profile hardcodes <openjpa.version>4.2.0-SNAPSHOT</openjpa.version>; the script always overrides it via -Dopenjpa.version, but the default silently goes stale after release - maybe add a comment that it must be kept in sync (same for the defaults baked into the README examples).
rmannibucau
left a comment
There was a problem hiding this comment.
overall good even if a few things surprised me, made claude running on it and he superseeded my review so just let him push his comment, several are worth checking, some are just "nice" but can be ignored IMHO
* In-memory JPA environment would incur in infinite loop when using REPLACE if the replacement string contains the replaced one * Fixes casts in TypecastAsNumber when running in-memory JPA env * Adds support for java.util.Date and fixes java.sql.Date treatment in TypecastAsString when running in-memory JPA env
LEFT and RIGHT now mimic behavior of PostgreSQL equivalent functions
… gitignore entries
…Class via PCEnhancer.isPCSubclassName
…s in in-memory JPAs
Hi! This work is an effort to implement JPA 3.2. I've started it a long time ago. Richard Zowalla picked it up and, with AI help (Claude), implemented the missing features, including some JPA <3.0 that weren't implemented.
I've tested it against default database, h2, mariadb(lts) e postgresql (18).
Please, check it against your favorite DB so we may fix some edge cases. It would be great if you can run TCK to be sure of the implementations.