⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 transactionimpl.java

📁 GridSphere 门户 提供一个基于 portlet 的高级开放源代码门户。GridSphere 是在欧盟提供基金的 GridLab 项目下开发的
💻 JAVA
字号:
package org.gridsphere.services.core.persistence.impl;import org.gridsphere.services.core.persistence.Transaction;import org.gridsphere.services.core.persistence.PersistenceManagerException;import org.apache.commons.logging.LogFactory;import org.apache.commons.logging.Log;public class TransactionImpl implements Transaction {    private static Log log = LogFactory.getLog(TransactionImpl.class);    private org.hibernate.Transaction hbTransaction = null;    public TransactionImpl(org.hibernate.Transaction hbTransaction) {        this.hbTransaction = hbTransaction;    }    /**	 * Flush the associated <tt>Session</tt> and end the unit of work.	 * This method will commit the underlying transaction if and only	 * if the transaction was initiated by this object.	 *	 * @throws PersistenceManagerException	 */	public void commit() throws PersistenceManagerException {        try {            this.hbTransaction.commit();        } catch (Exception e) {            log.error("Unable to perform commit hibernate transaction", e);            throw new PersistenceManagerException(e);        }    }	/**	 * Force the underlying transaction to roll back.	 *	 * @throws PersistenceManagerException	 */	public void rollback() throws PersistenceManagerException {        try {            this.hbTransaction.rollback();        } catch (Exception e) {            log.error("Unable to perform rollback hibernate transaction", e);            throw new PersistenceManagerException(e);        }    }	/**	 * Was this transaction rolled back or set to rollback only?	 *	 * @return boolean	 * @throws PersistenceManagerException	 */	public boolean wasRolledBack() throws PersistenceManagerException {        try {            return this.hbTransaction.wasRolledBack();        } catch (Exception e) {            log.error("Unable to check if transaction was rolled back", e);            throw new PersistenceManagerException(e);        }    }	/**	 * Check if this transaction was successfully committed. This method	 * could return <tt>false</tt> even after successful invocation	 * of <tt>commit()</tt>.	 *	 * @return boolean	 * @throws PersistenceManagerException	 */	public boolean wasCommitted() throws PersistenceManagerException {        try {            return this.hbTransaction.wasCommitted();        } catch (Exception e) {            log.error("Unable to check if transaction was committed", e);            throw new PersistenceManagerException(e);        }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -