com.avaje.ebeaninternal.server.transaction.JdbcTransaction Maven / Gradle / Ivy
/**
* Copyright (C) 2006 Robin Bygrave
*
* This file is part of Ebean.
*
* Ebean is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* Ebean is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Ebean; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
package com.avaje.ebeaninternal.server.transaction;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.persistence.PersistenceException;
import javax.persistence.RollbackException;
import com.avaje.ebean.LogLevel;
import com.avaje.ebean.bean.PersistenceContext;
import com.avaje.ebean.config.lucene.IndexUpdateFuture;
import com.avaje.ebeaninternal.api.DerivedRelationshipData;
import com.avaje.ebeaninternal.api.SpiTransaction;
import com.avaje.ebeaninternal.api.TransactionEvent;
import com.avaje.ebeaninternal.server.lucene.LIndexUpdateFuture;
import com.avaje.ebeaninternal.server.lucene.PersistenceLuceneException;
import com.avaje.ebeaninternal.server.persist.BatchControl;
import com.avaje.ebeaninternal.server.transaction.TransactionManager.OnQueryOnly;
/**
* JDBC Connection based transaction.
*/
public class JdbcTransaction implements SpiTransaction {
private static final Logger logger = Logger.getLogger(JdbcTransaction.class.getName());
private static final String illegalStateMessage = "Transaction is Inactive";
/**
* The associated TransactionManager.
*/
final protected TransactionManager manager;
/**
* The transaction id.
*/
final String id;
/**
* Flag to indicate if this was an explicitly created Transaction.
*/
final boolean explicit;
/**
* Behaviour for ending query only transactions.
*/
final OnQueryOnly onQueryOnly;
/**
* The status of the transaction.
*/
boolean active;
/**
* The underlying Connection.
*/
Connection connection;
/**
* Used to queue up persist requests for batch execution.
*/
BatchControl batchControl;
/**
* The event which holds persisted beans.
*/
TransactionEvent event;
/**
* Holder of the objects fetched to ensure unique objects are used.
*/
PersistenceContext persistenceContext;
/**
* Used to give developers more control over the insert update and delete
* functionality.
*/
boolean persistCascade = true;
/**
* Flag used for performance to skip commit or rollback of query only
* transactions in read committed transaction isolation.
*/
boolean queryOnly = true;
boolean localReadOnly;
LogLevel logLevel;
/**
* Set to true if using batch processing.
*/
boolean batchMode;
int batchSize = -1;
boolean batchFlushOnQuery = true;
Boolean batchGetGeneratedKeys;
Boolean batchFlushOnMixed;
/**
* The depth used by batch processing to help the ordering
* of statements.
*/
int depth = 0;
HashSet
© 2015 - 2025 Weber Informatics LLC | Privacy Policy