-
Notifications
You must be signed in to change notification settings - Fork 189
Open
Description
The following test fails on DB2:
org.eclipse.persistence.testing.tests.jpa.persistence32.SchemaManagerValidateOnMissingColumnTest.testValidateOnMissingColumn()
with
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 2.430 s <<< FAILURE! -- in org.eclipse.persistence.testing.tests.jpa.persistence32.SchemaManagerValidateOnMissingColumnTest
[ERROR] org.eclipse.persistence.testing.tests.jpa.persistence32.SchemaManagerValidateOnMissingColumnTest.testValidateOnMissingColumn -- Time elapsed: 2.408 s <<< FAILURE!
junit.framework.AssertionFailedError: Exception is not an instance of TableValidationException.MissingColumns
at junit.framework.Assert.fail(Assert.java:57)
at junit.framework.TestCase.fail(TestCase.java:223)
at org.eclipse.persistence.testing.tests.jpa.persistence32.SchemaManagerValidateOnMissingColumnTest.testValidateOnMissingColumn(SchemaManagerValidateOnMissingColumnTest.java:89)
What happens is that the test removed a column from a table, and the table is then in REORG_PENDING state:
db2 => select * from PERSISTENCE32_TEAM
ID
-----------
SQL0668N Operation not allowed for reason code "7" on table
"ROOTX.PERSISTENCE32_TEAM". SQLSTATE=57007
and
db2 => SELECT TABSCHEMA, TABNAME, REORG_PENDING FROM SYSIBMADM.ADMINTABINFO WHERE TABSCHEMA = 'ROOTX' AND TABNAME = 'PERSISTENCE32_TEAM';
TABSCHEMA TABNAME REORG_PENDING
-------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------- -------------
ROOTX PERSISTENCE32_TEAM Y
1 record(s) selected.
A straightforward solution is to call REORG on the table from within the test:
if (emf.getDatabaseSession().getPlatform().isDB2()) {
// After table modifications, DB2 needs a kind of secondary commit called a 'REORG'
// to make the table available again.
emf.getDatabaseSession()
.priviledgedExecuteNonSelectingCall(
new SQLCall("CALL SYSPROC.ADMIN_CMD('REORG TABLE PERSISTENCE32_TEAM')"));
}Metadata
Metadata
Assignees
Labels
No labels