diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/schemaframework/SequenceDefinition.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/schemaframework/SequenceDefinition.java index 55ad3b3a8af..cc0c5f37ed9 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/schemaframework/SequenceDefinition.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/tools/schemaframework/SequenceDefinition.java @@ -1,5 +1,6 @@ /* * Copyright (c) 1998, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019 Payara Services Ltd. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -19,6 +20,7 @@ import java.io.Writer; import org.eclipse.persistence.exceptions.*; import org.eclipse.persistence.internal.sessions.AbstractSession; +import org.eclipse.persistence.logging.SessionLog; import org.eclipse.persistence.sequencing.Sequence; /** @@ -84,13 +86,27 @@ public void alter(AbstractSession session, Writer writer) throws ValidationExcep */ @Override public void createOnDatabase(AbstractSession session) throws EclipseLinkException { - if (checkIfExist(session)) { + // If the sequence does not already exist a stack trace will be logged + // this temporarily  sets the level to FINEST to avoid having appear in the log + // unnecessarily + int logLevel = session.getLogLevel(); + session.setLogLevel(SessionLog.FINEST); + boolean sequenceExists; + try { + sequenceExists = checkIfExist(session); + } finally { + //reset log level + session.setLogLevel(logLevel); + } + + if (sequenceExists) { if (this.isAlterSupported(session)) { alterOnDatabase(session); } } else { super.createOnDatabase(session); } + } /**