Update OracleDictionary to use unqualified table name #137
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The issue
OracleDictionary utilises the getUnqualifiedName method for retrieving tables, but not for indexes or foreign keys.
As a result, openjpa is unable to locate indexes and foreign keys that were created on a previous initialisation, causing openjpa to attempt to create them again. Oracle throws an error when you attempt to do this, which causes exceptions to be thrown in openjpa.
Remediation
Adding getUnqualifiedName to the get index and foreign keys method remediates this issue, as openjpa can now retrieve the previously created indexes and foreign keys from the database.
Demonstration description:
This can be demonstrated by starting up an apache syncope installation (which utilises openjpa) with an oracle database.
The first start will fully initialise the database using OpenJPA as expected.
Upon restart of the syncope instance, OpenJPA attempts (and fails) to 'add' the foreign keys and indexes, as it does not recognise that they are already present.
Demonstration docker-compose.yml:
Commands for demonstration
N.b. JIRA issue will be opened once my apache JIRA account is created.