make sure tests drop tables Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
diff --git a/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/models/employee/relational/EmployeeSystem.java b/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/models/employee/relational/EmployeeSystem.java index d51e826..33bb8ec 100644 --- a/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/models/employee/relational/EmployeeSystem.java +++ b/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/models/employee/relational/EmployeeSystem.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1998, 2015 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2018 Oracle and/or its affiliates. All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 * which accompanies this distribution. @@ -50,6 +50,12 @@ public void createTables(DatabaseSession session) { * Drop table constraints */ public void dropTableConstraints(Session session) { + if (session.getLogin().getPlatform().isMySQL()) { + try { + session.executeNonSelectingCall(new SQLCall("SET FOREIGN_KEY_CHECKS = 0")); + } catch (Exception e) { + } + } if (!SchemaManager.FAST_TABLE_CREATOR && !useFastTableCreatorAfterInitialCreate) { if (session.getLogin().getPlatform().isOracle()) { try { @@ -152,6 +158,12 @@ public void dropTableConstraints(Session session) { } catch (Exception e) { } } + if (session.getLogin().getPlatform().isMySQL()) { + try { + session.executeNonSelectingCall(new SQLCall("SET FOREIGN_KEY_CHECKS = 1")); + } catch (Exception e) { + } + } } /**
diff --git a/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/history/HistoricalEmployeeSystem.java b/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/history/HistoricalEmployeeSystem.java index 96f64f9..21edb14 100644 --- a/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/history/HistoricalEmployeeSystem.java +++ b/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/history/HistoricalEmployeeSystem.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1998, 2015 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2018 Oracle and/or its affiliates. All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 * which accompanies this distribution. @@ -76,6 +76,9 @@ public void createTables(DatabaseSession session) { executeCall(session, "drop table EMPLOYEE CASCADE CONSTRAINTS"); executeCall(session, "drop table ADDRESS CASCADE CONSTRAINTS"); } else { + if (session.getPlatform().isMySQL()) { + executeCall(session, "SET FOREIGN_KEY_CHECKS = 0"); + } executeCall(session, "drop table PHONE"); executeCall(session, "drop table RESPONS"); executeCall(session, "drop table SALARY"); @@ -84,6 +87,9 @@ public void createTables(DatabaseSession session) { executeCall(session, "drop table PROJECT"); executeCall(session, "drop table EMPLOYEE"); executeCall(session, "drop table ADDRESS"); + if (session.getPlatform().isMySQL()) { + executeCall(session, "SET FOREIGN_KEY_CHECKS = 1"); + } } }