Sylinsic opened a new pull request, #137: URL: https://github.com/apache/openjpa/pull/137
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. 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: 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. Demo docker-compose.yml: ` networks: openjpa: services: db: container_name: db image: gvenzl/oracle-free:23-slim restart: always environment: ORACLE_PASSWORD: syncope APP_USER: syncope APP_USER_PASSWORD: syncope networks: - openjpa syncope: container_name: syncope depends_on: - db image: apache/syncope:4.0.0 ports: - "18080:8080" restart: always environment: SPRING_PROFILES_ACTIVE: docker,oracle DB_URL: jdbc:oracle:thin:@//db:1521/FREEPDB1 DB_SCHEMA: syncope DB_USER: syncope DB_PASSWORD: syncope DB_POOL_MAX: 20 DB_POOL_MIN: 5 OPENJPA_REMOTE_COMMIT: sjvm KEYMASTER_ADDRESS: http://syncope:8080/syncope/rest/keymaster KEYMASTER_USERNAME: anonymous KEYMASTER_PASSWORD: password SERVICE_DISCOVERY_ADDRESS: http://syncope:8080/syncope/rest/ ANONYMOUS_USER: anonymous ANONYMOUS_KEY: password networks: - openjpa ` Commands for demo: 1. docker compose up -d 2. docker logs -f syncope - Wait for 'Started SyncopeCoreApplication in XX.XXX seconds' to appear in syncope logs. At this point, the database will have been fully initialised by OpenJPA 4. docker stop syncope 5. docker start syncope 6. docker logs -f syncope - Observe logs of syncope, which will indicate the failure to create foreign keys (and subsequently a container restart due to syncope failing to fully start N.b. JIRA issue will be opened once my apache JIRA account is created. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@openjpa.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org