Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.0] org.eclipse.persistence.jpa.jse.test test fixes against Oracle DB - backport from master #1419

Merged
merged 2 commits into from Feb 9, 2022

Conversation

rfelcman
Copy link
Contributor

@rfelcman rfelcman commented Feb 2, 2022

This PR contains fixes for following test errors if JPA JSE tests are executed against Oracle DB:

  1. org.eclipse.persistence.jpa.embeddable.TestCollectionTableEmbeddable
[ERROR] Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2.281 s <<< FAILURE! - in org.eclipse.persistence.jpa.embeddable.TestCollectionTableEmbeddable
[ERROR] org.eclipse.persistence.jpa.embeddable.TestCollectionTableEmbeddable.mergeTest  Time elapsed: 0.325 s  <<< ERROR!
org.eclipse.persistence.exceptions.ConversionException: 

Exception Description: The object [04-DEC-21 03.56.45.937000000 AM], of class [class java.lang.String], from mapping [org.eclipse.persistence.mappings.DirectToFieldMapping[temporalValue-->EntMapDateTemporal.TEMPORALVALUE]] with descriptor [RelationalDescriptor(org.eclipse.persistence.jpa.embeddable.model.ElementCollectionEmbeddableTemporal --> [DatabaseTable(EntMapDateTemporal)])], could not be converted to [class java.sql.Timestamp].
	at org.eclipse.persistence.jpa.embeddable.TestCollectionTableEmbeddable.mergeTest(TestCollectionTableEmbeddable.java:73)

In entity org.eclipse.persistence.jpa.embeddable.model.ElementCollectionEmbeddableTemporal is specified DB column type. Without this is VARCHAR2 used. VARCHAR2 is problematic in case of read operation (conversion) back into java.util.Date.

  1. org.eclipse.persistence.jpa.test.lob.TestLobMerge
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.646 s <<< FAILURE! - in org.eclipse.persistence.jpa.test.lob.TestLobMerge
[ERROR] org.eclipse.persistence.jpa.test.lob.TestLobMerge.testLobMerge  Time elapsed: 1.543 s  <<< ERROR!
jakarta.persistence.RollbackException: 
Exception [EclipseLink-4002] (Eclipse Persistence Services - 4.0.0.v202112030849): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLSyntaxErrorException: ORA-00932: inconsistent datatypes: expected - got CLOB

Error Code: 932
Call: DELETE FROM ParentEntity_SUBS WHERE (((content = ?) AND (label = ?)) AND (parent_id = ?))
	bind => [3 parameters bound]
Query: DeleteObjectQuery(org.eclipse.persistence.jpa.test.lob.model.CollectedEntity@9bffba99)
	at org.eclipse.persistence.jpa.test.lob.TestLobMerge.testLobMerge(TestLobMerge.java:78)
Caused by: org.eclipse.persistence.exceptions.DatabaseException: 

Internal Exception: java.sql.SQLSyntaxErrorException: ORA-00932: inconsistent datatypes: expected - got CLOB

It leads into EclipseLink fix in some *Platform classes, org.eclipse.persistence.internal.descriptors.ObjectBuilder and org.eclipse.persistence.mappings.foundation.AbstractDirectMapping.

  1. org.eclipse.persistence.jpa.test.mapping.TestMultitenantOneToMany
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.106 s <<< FAILURE! - in org.eclipse.persistence.jpa.test.mapping.TestMultitenantOneToMany
[ERROR] org.eclipse.persistence.jpa.test.mapping.TestMultitenantOneToMany.testMultitenancySchemaDescriminatorWithOneToMany  Time elapsed: 0.1 s  <<< ERROR!
jakarta.persistence.PersistenceException: 
Exception [EclipseLink-4002] (Eclipse Persistence Services - 4.0.0.v202112070752): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLSyntaxErrorException: ORA-02420: missing schema authorization clause

Error Code: 2420
Call: CREATE SCHEMA tenant_1
Query: DataModifyQuery(sql="CREATE SCHEMA tenant_1")
	at org.eclipse.persistence.jpa.test.mapping.TestMultitenantOneToMany.setup(TestMultitenantOneToMany.java:59)
Caused by: org.eclipse.persistence.exceptions.DatabaseException: 

Internal Exception: java.sql.SQLSyntaxErrorException: ORA-02420: missing schema authorization clause

Test change to use prefix based multitenancy.

Signed-off-by: Radek Felcman radek.felcman@oracle.com

…lipse-ee4j#1370)

JPA JSE Tests against Oracle DB fixes

Signed-off-by: Radek Felcman <radek.felcman@oracle.com>

(cherry picked from commit 5763e7e)
Signed-off-by: Radek Felcman <radek.felcman@oracle.com>
Signed-off-by: Radek Felcman <radek.felcman@oracle.com>
Copy link
Member

@lukasj lukasj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rfelcman rfelcman merged commit 158a242 into eclipse-ee4j:3.0 Feb 9, 2022
@rfelcman rfelcman deleted the jpa_jse_test_oracle_fixes_3.0 branch February 11, 2022 10:58
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.

None yet

2 participants