/** * Begin a transaction on the database. If not using managed transaction begin a local transaction. */ public void beginTransaction(AbstractSession session) throws DatabaseException { if (usesExternalTransactionController()) { if (session.isExclusiveConnectionRequired() && !this.isInTransaction && this.usesExternalConnectionPooling) { closeConnection(); } this.isInTransaction = true; return; } session.log(SessionLog.FINER, SessionLog.TRANSACTION, "begin_transaction", (Object[])null, this); try { session.startOperationProfile(SessionProfiler.Transaction); incrementCallCount(session); basicBeginTransaction(session); this.isInTransaction = true; } finally { decrementCallCount(); session.endOperationProfile(SessionProfiler.Transaction); } }
/** * Clone the accessor. */ public Object clone() { DatabaseAccessor accessor = (DatabaseAccessor)super.clone(); accessor.dynamicSQLMechanism = null; accessor.activeBatchWritingMechanism = null; accessor.parameterizedMechanism = null; accessor.statementCache = null; return accessor; }
/** * Commit a transaction on the database. First flush any batched statements. */ @Override public void commitTransaction(AbstractSession session) throws DatabaseException { this.writesCompleted(session); super.commitTransaction(session); }
/** * Called from beforeCompletion external transaction synchronization listener callback * to close the external connection corresponding to the completing external transaction. * Final sql calls could be sent through the connection by this method * before it closes the connection. */ public void closeJTSConnection() { if (usesExternalTransactionController()) { this.isInTransaction = false; if (this.usesExternalConnectionPooling) { closeConnection(); } } }
session.log(SessionLog.CONFIG, SessionLog.CONNECTION, "connecting", new Object[] { login }, this); setLogin(login); this.setDatasourcePlatform((DatasourcePlatform)session.getDatasourceLogin().getDatasourcePlatform()); createCustomizer(session); try { connectInternal(login, session); this.isInTransaction = false; } catch (RuntimeException exception) { session.getEventManager().postConnect(this); incrementCallCount(session); try { buildConnectLog(session); } finally { decrementCallCount();
if (usesExternalTransactionController()) { closeConnection(); incrementCallCount(session); basicRollbackTransaction(session); } finally { this.isInTransaction = false; sequencingCallback = null; decrementCallCount(); session.endOperationProfile(SessionProfiler.Transaction);
if (usesExternalTransactionController()) { closeConnection(); incrementCallCount(session); basicCommitTransaction(session); } finally { sequencingCallback = null; decrementCallCount(); session.endOperationProfile(SessionProfiler.TRANSACTION);
/** * Disconnect from the datasource. */ public void disconnect(AbstractSession session) throws DatabaseException { session.log(SessionLog.CONFIG, SessionLog.CONNECTION, "disconnect", (Object[])null, this); if (this.datasourceConnection == null) { return; } session.incrementProfile(SessionProfiler.TlDisconnects); session.startOperationProfile(SessionProfiler.CONNECT); releaseCustomizer(); closeDatasourceConnection(); this.datasourceConnection = null; this.isInTransaction = true; session.endOperationProfile(SessionProfiler.CONNECT); }
/** * Close the accessor's connection. * This is used only for external connection pooling * when it is intended for the connection to be reconnected in the future. */ public void closeConnection() { try { if (this.datasourceConnection != null) { if (isDatasourceConnected()) { if(currentSession != null) { currentSession.preReleaseConnection(this); } if(customizer != null && customizer.isActive()) { customizer.clear(); } closeDatasourceConnection(); } this.datasourceConnection = null; } } catch (DatabaseException exception) { // Ignore this.datasourceConnection = null; } finally { currentSession = null; } }
/** * Close the accessor's connection. * This is used only for external connection pooling * when it is intended for the connection to be reconnected in the future. */ @Override public void closeConnection() { // Unfortunately do not have the session to pass, fortunately it is not used. clearStatementCache(null); super.closeConnection(); }
/** * Connect to the database. * Exceptions are caught and re-thrown as EclipseLink exceptions. * Must set the transaction isolation. */ protected void connectInternal(Login login, AbstractSession session) throws DatabaseException { super.connectInternal(login, session); checkTransactionIsolation(session); }
/** * Execute the call. * @return depending of the type either the row count, row or vector of rows. */ public Object executeCall(Call call, AbstractRecord translationRow, AbstractSession session) throws DatabaseException { // If the login is null, then this accessor has never been connected. if (this.login == null) { throw DatabaseException.databaseAccessorNotConnected(); } if (session.shouldLog(SessionLog.FINE, SessionLog.SQL)) {// pre-check to improve performance session.log(SessionLog.FINE, SessionLog.SQL, call.getLogString(this), (Object[])null, this, false); } Object result = basicExecuteCall(call, translationRow, session); return result; }
session.log(SessionLog.CONFIG, SessionLog.CONNECTION, "connecting", new Object[] { login }, this); setLogin(login); this.setDatasourcePlatform((DatasourcePlatform)session.getDatasourceLogin().getDatasourcePlatform()); createCustomizer(session); try { connectInternal(login, session); this.isInTransaction = false; } catch (RuntimeException exception) { session.getEventManager().postConnect(this); incrementCallCount(session); try { buildConnectLog(session); } finally { decrementCallCount();
if (usesExternalTransactionController()) { closeConnection(); incrementCallCount(session); basicRollbackTransaction(session); } finally { this.isInTransaction = false; sequencingCallback = null; decrementCallCount(); session.endOperationProfile(SessionProfiler.Transaction);
if (usesExternalTransactionController()) { closeConnection(); incrementCallCount(session); basicCommitTransaction(session); } finally { sequencingCallback = null; decrementCallCount(); session.endOperationProfile(SessionProfiler.Transaction);
/** * Called from beforeCompletion external transaction synchronization listener callback * to close the external connection corresponding to the completing external transaction. * Final sql calls could be sent through the connection by this method * before it closes the connection. */ public void closeJTSConnection() { if (usesExternalTransactionController()) { this.isInTransaction = false; if (this.usesExternalConnectionPooling) { closeConnection(); } } }
/** * Disconnect from the datasource. */ public void disconnect(AbstractSession session) throws DatabaseException { session.log(SessionLog.CONFIG, SessionLog.CONNECTION, "disconnect", (Object[])null, this); if (this.datasourceConnection == null) { return; } session.incrementProfile(SessionProfiler.Disconnects); session.startOperationProfile(SessionProfiler.ConnectionManagement); try { releaseCustomizer(); closeDatasourceConnection(); this.datasourceConnection = null; this.isInTransaction = true; } finally { session.endOperationProfile(SessionProfiler.ConnectionManagement); } }
/** * Close the accessor's connection. * This is used only for external connection pooling * when it is intended for the connection to be reconnected in the future. */ public void closeConnection() { try { if (this.datasourceConnection != null) { if (isDatasourceConnected()) { if(currentSession != null) { currentSession.preReleaseConnection(this); } if(customizer != null && customizer.isActive()) { customizer.clear(); } closeDatasourceConnection(); } this.datasourceConnection = null; } } catch (DatabaseException exception) { // Ignore this.datasourceConnection = null; } finally { currentSession = null; } }
/** * Close the accessor's connection. * This is used only for external connection pooling * when it is intended for the connection to be reconnected in the future. */ @Override public void closeConnection() { // Unfortunately do not have the session to pass, fortunately it is not used. clearStatementCache(null); super.closeConnection(); }
/** * Attempt to save some of the cost associated with getting a fresh connection. * Assume the DatabaseDriver has been cached, if appropriate. * Note: Connections that are participating in transactions will not be refreshed.^M */ protected void reconnect(AbstractSession session) throws DatabaseException { session.log(SessionLog.FINEST, SessionLog.CONNECTION, "reconnecting_to_external_connection_pool"); session.startOperationProfile(SessionProfiler.CONNECT); connectInternal(this.login, session); session.endOperationProfile(SessionProfiler.CONNECT); }