Skip to content

[OPENJPA-3028] Oracle unit tests and test profiles - #281

Merged
solomax merged 6 commits into
masterfrom
OPENJPA-3028-oracle-unittests
Nov 7, 2026
Merged

solomax merged 6 commits into
masterfrom
OPENJPA-3028-oracle-unittests

Conversation

@rzo1

@rzo1 rzo1 commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

COALESCE/CASE/NULLIF of java.sql.Date/Time are read with getDate/getTime (ClassCastException on Oracle). Three tests fixed for Oracle. test-oracle-docker now runs Oracle Free 23 with ojdbc11 and enough processes; test-oracle uses ojdbc11 from Maven Central.

With all Oracle PRs combined: Oracle TCK 2131 pass / 0 errors; Oracle unit tests only fail in TestPessimisticLockException/TestTimeoutException (OPENJPA-3000).

rzo1 added 6 commits November 6, 2026 11:31
…ime as such

The Oracle driver returns a Timestamp for a DATE column, which also holds
java.sql.Date and java.sql.Time fields. Selecting COALESCE or CASE over
such a field loaded the value with getObject and converted it to the type
of the field, which failed on Oracle with "ClassCastException: Cannot
convert object ... of type class java.sql.Timestamp into an instance of
class java.sql.Date".

COALESCE, CASE and NULLIF expressions of type java.sql.Date or
java.sql.Time are now read with ResultSet.getDate and getTime, so the
driver does the conversion. Such queries now return a java.sql.Date or
java.sql.Time on Oracle, as on the other databases. Expressions of any
other type are read with getObject as before, and Filters.convert is
unchanged.
…eSharedCollectionTable

Oracle has no BIGINT type, so creating the shared collection table
failed with ORA-00902. The owner join column now takes the type of the
id column it references, as on the other databases.
The type of NULLIF over a date field and a JDBC escape is not known, so
the value of the driver is returned as it is. A date field is mapped to
an Oracle DATE, for which the Oracle driver returns a Timestamp, so
testCaseAndNullIfInMemory failed with "expected:<[2022-06-15 00:00:00.0,
null]> but was:<[2022-06-15, null]>". On Oracle a Timestamp at the start
of a day is now compared as the date it stands for.
…ForUnmappedForeignKey

testCycleOfNullableLogicalForeignKeys counts the DELETE statements of a
flush. Oracle batches statements by default, so both DELETEs were run as
one batch and counted once ("expected:<2> but was:<1>"). This test now
disables batching while it runs; the other tests of the class keep the
batch limit of the database.
…Free

The profile used gvenzl/oracle-xe 18.4, which has no arm64 image, and
the ojdbc8 19.3 driver. It now starts gvenzl/oracle-free:23-slim and
tests with ojdbc11 23.26.4.0.0 from Maven Central.

The init script did not take effect: it set processes=250 in the spfile
without restarting the database, and the image now reads its init
scripts from /container-entrypoint-initdb.d. It is replaced by a shell
script that raises processes to 1000 and sessions to 1600 and restarts
the database before the image reports it ready, so the test suite no
longer runs out of connections (ORA-12516/ORA-12519).

The EM Express port 5500 is no longer published, and the build matrix
and TCK runner scripts stop the container by its new name.

Usage:
  mvn -N -Ptest-oracle-docker docker:start
  mvn install -Ptest-oracle-docker
  mvn -N -Ptest-oracle-docker docker:stop
…oracle profile

The test-oracle profile, for an Oracle database of your own, defaulted to
com.oracle.ojdbc:ojdbc8:19.3.0.0 and documented installing a driver into
a local repository by hand. It now defaults to
com.oracle.database.jdbc:ojdbc11:23.26.4.0.0 from Maven Central, as the
test-oracle-docker profile does. The unused oracle.maven.repo property is
removed. Another driver can still be chosen with -Doracle.groupid,
-Doracle.artifactid and -Doracle.version.
@rzo1
rzo1 requested review from cristof and solomax November 6, 2026 14:16
@solomax
solomax merged commit d6225ba into master Nov 7, 2026
4 checks passed
@solomax
solomax deleted the OPENJPA-3028-oracle-unittests branch November 7, 2026 03:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants